The wizard for the new test suite in Eclipse, which looks like the current project, is for JUNIT3, and a lot of data on the web, the test suite is Junit3, and here's a quick overview of how the test suite in JUNIT4 is used.
One is similar to the Junit3 method:
public class TestSuite1 {The public
Static test suite () {
TestSuite suite = new TestSuite (' Test for Package1 ');
Suite.addtest (New Junit4testadapter (Test1.class));
Suite.addtest (New Junit4testadapter (Test2.class));
Suite.addtest (New Junit4testadapter (Test3.class));
Suite.addtest (New Junit4testadapter (Testsuite2.class));
return suite;
}
}
Junit3 is the direct suite.addtest (test1.class), JUNIT4 need to use Junit4testadapter to convert. Testsuite can also be added Testsuite, the same method, namely Suite.addtest (new Junit4testadapter (Testsuite2.class));
Another way to use annotations is to:
@RunWith (Suite.class)
@Suite. suiteclasses ({
test1.class,
test2.class,
Test3.class,
Testsuite2.class
}) public
class TestSuite1 {
}