|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object momeunit.framework.TestSuite
public class TestSuite
A collection of tests that can be processed together. TestSuite has a name
property that identifies it. It can be returned or modified using property
methods It can be also preset during instantiation using
TestSuite(String)
,TestSuite(String, Class[])
or
TestSuite(String, String[])
constructors. A test can be added to
TestSuite by calling addTest(Class)
or addTest(String)
method with class or name of class implementing Test
interface. A
test can also be added to TestSuite by calling addTest(Test)
method
with test instance. The collection of tests can be preset during
instantiation by using a constructors TestSuite(Class[])
,
TestSuite(String[])
, TestSuite(String, Class[])
or
TestSuite(String, String[])
. The arguments to these constructors
are optional name of test suite and array of classes or names of classes
implementing Test
interface. To run tests that constitute this
TestSuite call run(TestResult)
. To run some test call
runTest(Test, TestResult)
method. There are also getter methods that
return number of tests in test suite, number of TestCases in test suite (test
suite can also contain other test suites or any other Test
implementations), test at specified position.
Test
,
TestSuite.ErrorTestCase
Nested Class Summary | |
---|---|
(package private) class |
TestSuite.ErrorTestCase
Returns the name of the suite. |
Constructor Summary | |
---|---|
TestSuite()
Constructs an empty TestSuite. |
|
TestSuite(Class[] classes)
Constructs a TestSuite with default name consisting of tests specified as classes. |
|
TestSuite(String name)
Constructs an empty TestSuite with specified name. |
|
TestSuite(String[] classes)
Constructs a TestSuite with default name consisting of tests specified as classnames. |
|
TestSuite(String name,
Class[] classes)
Constructs a TestSuite with the given name consisting of tests specified as classes. |
|
TestSuite(String name,
String[] classes)
Constructs a TestSuite with the given name consisting of tests specified as classnames. |
Method Summary | |
---|---|
void |
addTest(Class testClass)
Adds test specified by class implementing Test to the test suite. |
void |
addTest(String className)
Adds test specified by name of class implementing Test to the test suite. |
void |
addTest(Test test)
Adds specified test to the test suite. |
int |
countTestCases()
Counts the number of test cases that will be run by this test. |
String |
getName()
Returns the name of the test suite. |
void |
run(TestResult result)
Runs tests of this test suite and collects results in a TestResult instance. |
void |
runTest(Test test,
TestResult result)
Runs the specified test and populates the specified TestResult with results of test. |
void |
setName(String name)
Sets the name of test suite to the specified or default, if name is null . |
Test |
testAt(int index)
Returns the test at the given index. |
int |
testCount()
Returns the number of tests that constitute test suite. |
Enumeration |
tests()
Returns enumeration of tests that constitute test suite. |
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(String name)
name
- the name of test suite.public TestSuite(Class[] classes)
classes
- array of classes implementing Test interface.public TestSuite(String[] classes)
classes
- array of names of classes implementing Test interface.public TestSuite(String name, Class[] classes)
name
- the name of test suite.classes
- array of classes implementing Test interface.public TestSuite(String name, String[] classes)
name
- the name of test suite.classes
- array of names of classes implementing Test interface.Method Detail |
---|
public String getName()
public void setName(String name)
name
is null
.
name
- name of test suite or null.public void addTest(Test test)
test
- test to be added to the test suite.public void addTest(Class testClass)
testClass
- class implementing Test to be added to the test suite.public void addTest(String className)
className
- name of class implementing Test to be added to the test suite.public int countTestCases()
Test
countTestCases
in interface Test
public void run(TestResult result)
run
in interface Test
Test.run(momeunit.framework.TestResult)
public void runTest(Test test, TestResult result)
test
- test to be run.result
- TestResult instance to be populated with results of the test.public Test testAt(int index)
index
- index of the test to be returned.
public int testCount()
public Enumeration tests()
public String toString()
toString
in class Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |