All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class junit.framework.TestSuite

java.lang.Object
   |
   +----junit.framework.TestSuite

public class TestSuite
extends Object
implements Test
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.

See Also:
Test

Constructor Index

 o TestSuite()
Constructs an empty TestSuite.
 o TestSuite(Class)
Constructs a TestSuite from the given class.

Method Index

 o addTest(Test)
Adds a test to the suite.
 o countTestCases()
Counts the number of test cases that will be run by this test.
 o run(TestResult)
Runs the tests and collects their result in a TestResult.

Constructors

 o TestSuite
 public TestSuite()
Constructs an empty TestSuite.

 o TestSuite
 public TestSuite(Class theClass)
Constructs a TestSuite from the given class. Adds all the methods starting with "test" as test cases to the suite.

Methods

 o addTest
 public void addTest(Test test)
Adds a test to the suite.

 o countTestCases
 public int countTestCases()
Counts the number of test cases that will be run by this test.

 o run
 public void run(TestResult result)
Runs the tests and collects their result in a TestResult.


All Packages  Class Hierarchy  This Package  Previous  Next  Index