我有一个测试套件。我想要执行整个测试套件1000次。我用Google搜索并到处寻找,我似乎无法解决这个问题。任何帮助将不胜感激!!如果切换到testng会更容易,我会的。
package com.bpms.tests;
import org.junit.runner.RunWith;
import org.junit.runners.Suite;
import org.junit.runners.Suite.SuiteClasses;
@RunWith(Suite.class)
@SuiteClasses({
InitiateBuyPlan.class,
AddItemsToBuyPlan.class,
ReviewBuyPlan.class,
ApproveBuyPlan.class,
ManageQuoteSolicitation.class,
StartQuote.class,
ReviewQuote.class,
RecordInterestInQuotes.class,
ReviewCountryBuyIn.class,
CompleteItemInfo.class,
ReviewItemInformation.class,
})
public class SuiteAllTests
{
}
答案 0 :(得分:2)
您必须以编程方式构建测试用例而不是通过注释
import org.junit.runners.AllTests;
import junit.framework.TestSuite;
import junit.framework.Test;
@RunWith(AllTests.class)
public final class SuiteAllTests {
public static TestSuite suite() {
TestSuite suite = new TestSuite();
for (int i= 0; i<1000; i++) {
suite.addTest(new JUnit4TestAdapter(XXX.class));
suite.addTest(new JUnit4TestAdapter(YYY.class));
}
return suite;
}
}
只需将XXX和YYY替换为注释中的类。