我有一个针对JAVA项目的TestNG测试套件,在其中我有一个使用@DataProvider="ListOfObjects"注释的方法。该方法提供了大约20行数据。(因此该方法运行20次)。现在,我想要运行这个类2小时(作为SOAK相关测试的一部分)。平均每次运行该类需要大约10分钟。所以我考虑将整个类运行12次,并因此考虑在类本身上使用@Test(invocationCount = 20)。有更好的想法吗?
@Test
public void RepeatTestSuite() {
long startTime = new Date().getTime();
while(!isTestFinished(startTime)) {
List<String> suites = new ArrayList<String>();
suites.add("./SOAK_all41.xml"); //path of .xml file to be run-provide complete path
TestNG tng = new TestNG();
tng.setTestSuites(suites);
tng.run(); //run test suite
}