如何让junit的测试跑多次
对JUnit4可以使用下面的方法:
@RunWith(Parameterized.class) public class RunTenTimes { @Parameterized.Parameters public static Object[][] data() { return new Object[10][0]; // repeat count which you want } @Test public void runsTenTimes() { System.out.println("run"); } }
下图是我执行了十次的结果:
对JUnit5可以使用下面的方法:
@RepeatedTest(10) // repeat count which you want public void testMyCode() { //your test code goes here }
相关推荐
shirleypaddy 2020-10-19
qingmumu 2020-10-19
lustdevil 2020-10-18
ganlulululu 2020-10-12
lustdevil 2020-08-03
lustdevil 2020-07-18
lustdevil 2020-06-25
lustdevil 2020-06-21
zhengzf0 2020-06-21
宿命java 2020-06-15
JackYin 2020-06-14
dongxurr 2020-06-07
snowphy 2020-06-06
zhengzf0 2020-05-28
81901836 2020-05-26
Julywhj 2020-05-26