A
TestSuite
is a
Composite
of Tests. It runs a collection of test cases. Here is an example using the dynamic test definition.
TestSuite suite= new TestSuite(); suite.addTest(new MathTest("testAdd")); suite.addTest(new MathTest("testDivideByZero"));
Alternatively, a TestSuite can extract the tests to be run automatically. To do so you pass the class of your TestCase class to the TestSuite constructor.
TestSuite suite= new TestSuite(MathTest.class);
This constructor creates a suite with all the methods starting with "test" that take no arguments.
A final option is to do the same for a large array of test classes.
Class[] testClasses = { MathTest.class, AnotherTest.class } TestSuite suite= new TestSuite(testClasses);
@see Test