|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectj2meunit.framework.TestSuite
public class TestSuite
A TestSuite is a collection of Test instances which can be run
together. It is created by adding single tests (normally by using a
TestMethod) or other suites to it:
TestSuite suite = new TestSuite();
suite.addTest(new MathTest("testAdd"));
suite.addTest(new MathTest("testDivideByZero"));
suite.addTest(new ValueTest().suite());
| Constructor Summary | |
|---|---|
TestSuite()
Default constructor. |
|
TestSuite(java.lang.Class theClass,
java.lang.String[] testNames)
Creates a new test suite for certain methods of a particular test case class. |
|
TestSuite(java.lang.String sName)
To create a test suite with a particular name. |
|
TestSuite(Test rTest)
To create a test suite initialized with a single test. |
|
TestSuite(Test[] rTests)
To create a test suite initialized with multiple tests. |
|
| Method Summary | |
|---|---|
void |
addTest(Test test)
Adds a test to the suite. |
int |
countTestCases()
Counts the number of test cases that will be run by this suite. |
int |
countTestSteps()
Counts the number of test steps that will be run by this suite. |
void |
run(TestResult result)
Runs the tests and collects their result in a TestResult. |
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()
Create a string description of the suite. |
| 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.String sName)
sName - The name of the test suite.public TestSuite(Test rTest)
rTest - The test to add to the suitepublic TestSuite(Test[] rTests)
rTests - The tests to add to the suite
public TestSuite(java.lang.Class theClass,
java.lang.String[] testNames)
Since version 1.1 the recommended (and easier) method to create test instances and suites is to use the TestMethod interface to wrap the methods of a test case in an anonymous inner class, initialize a TestCase instance for each, and then hand the test(s) over to one of the constructors of TestSuite that accept Test instances.
theClass - The Class instance of a TestCase subclasstestNames - The names of the methods to run| Method Detail |
|---|
public void addTest(Test test)
test - The test to addpublic int countTestCases()
countTestCases in interface Testpublic int countTestSteps()
countTestSteps in interface TestTest.countTestSteps()public void run(TestResult result)
run in interface Testresult - The TestResult to collect the results inpublic Test testAt(int index)
index - The index position of the test
public int testCount()
public java.util.Enumeration tests()
public java.lang.String toString()
toString in class java.lang.Object
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||