You can use oracle JDK to create a executor service which schedules the running /execution of the test suite periodically unless you shut down the service
Please have a look at the below oracle doc
https://docs.oracle.com/javase/7/docs/api/java/util/concurrent/ScheduledExecutorService.html
Sample
import static java.util.concurrent.TimeUnit.*;
class BeeperControl {
private final ScheduledExecutorService scheduler =
Executors.newScheduledThreadPool(1);
public void beepForAnHour() {
final Runnable beeper = new Runnable() {
public void run() { System.out.println("beep"); }
};
final ScheduledFuture<?> beeperHandle =
scheduler.scheduleAtFixedRate(beeper, 10, 10, SECONDS);
scheduler.schedule(new Runnable() {
public void run() { beeperHandle.cancel(true); }
}, 60 * 60, SECONDS);
}
}
3条答案
按热度按时间bn31dyow1#
在测试的运行配置中有一个“重复:“选项,您可以在其中指定重复次数,例如直到测试失败。我相信这是自IntelliJ IDEA 15以来可用的。
nzkunb0c2#
nukf8bse3#
基于@Bas Leijdekkers的评论
IntelliJ IDEA 2023.2.2
右键单击测试类或测试->更多运行/配置->修改运行配置. ->
修改选项->重复
选择N次
“重复计数:“将出现现在只是申请和你自由去:)