|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--junit.framework.TestSuite
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.
Test
Constructor Summary | |
TestSuite()
Constructs an empty TestSuite. |
|
TestSuite(java.lang.Class theClass)
Constructs a TestSuite from the given class. |
|
TestSuite(java.lang.String name)
Constructs an empty TestSuite. |
Method Summary | |
void |
addTest(Test test)
Adds a test to the suite. |
void |
addTestSuite(java.lang.Class testClass)
Adds the tests from the given class to the suite |
int |
countTestCases()
Counts the number of test cases that will be run by this test. |
java.lang.String |
getName()
Returns the name of the suite. |
void |
run(TestResult result)
Runs the tests and collects their result in a TestResult. |
void |
runTest(Test test,
TestResult result)
|
void |
setName(java.lang.String name)
Sets the name of the suite. |
Test |
testAt(int index)
Returns the test at the given index |
int |
testCount()
Returns the number of tests in this suite |
java.util.Enumeration |
tests()
Returns the tests as an enumeration |
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
wait,
wait,
wait |
Constructor Detail |
public TestSuite()
public TestSuite(java.lang.Class theClass)
public TestSuite(java.lang.String name)
Method Detail |
public void addTest(Test test)
public void addTestSuite(java.lang.Class testClass)
public int countTestCases()
public void run(TestResult result)
public void runTest(Test test, TestResult result)
public Test testAt(int index)
public int testCount()
public java.util.Enumeration tests()
public java.lang.String toString()
public void setName(java.lang.String name)
name
- The name to setpublic java.lang.String getName()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |