我使用SWTBot在我的环境中运行自动化。 我在每个套件中创建了2个套件和2个测试用例 - 问题是我对两个套件使用了相同的测试用例。
TestSuite suite = new TestSuite("Test Suite 1");
suite.addTest(new JUnit4TestAdapter(Test1.class));
suite.addTest(new JUnit4TestAdapter(Test2.class));
TestSuite suite = new TestSuite("Test Suite 2");
suite.addTest(new JUnit4TestAdapter(Test1.class));
suite.addTest(new JUnit4TestAdapter(Test2.class));
当我运行SWTBot时,它只运行一个套件两次..请在此处查看我的代码:
@RunWith(Suite.class)
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
@SuiteClasses({
SuiteOneAllTests.class,
SuiteTwoAllTests.class })
....//Code..
public class SuiteOneAllTests extends TestSuite {
/**
* Function for running all test cases
* @return suite (All test cases)
* @throws Exception
*/
public static Test suite() throws Exception {
TestSuite suite = new TestSuite("Test Suite 1");
suite.addTest(new JUnit4TestAdapter(Test1.class));
suite.addTest(new JUnit4TestAdapter(Test2.class));
return suite;
}
}
public class SuiteTwoAllTestsextends TestSuite {
/**
* Function for running all test cases
* @return suite (All test cases)
* @throws Exception
*/
public static Test suite() throws Exception {
TestSuite suite = new TestSuite("Test Suite 1");
suite.addTest(new JUnit4TestAdapter(Test1.class));
suite.addTest(new JUnit4TestAdapter(Test2.class));
return suite;
}
}