background image
<< Construction by Test Class | Integration of Objects Under Test >>
<< Construction by Test Class | Integration of Objects Under Test >>

Building a Test Suite

Automated Testing
This framework requires that you manually perform the two following additional
steps:
9.
Create a test suite class Suite() that transforms a test class into a J2ME test suite.
10. Create
a
runTest() primitive that transforms the name of the test case into a
relevant call to the test function.
The objects under test must belong to the test class and must have been initialized in
the setUp method.
The following code sample is a runTest selection method for J2ME, which switches
the correct test method depending on the name of the test case:
protected void runTest() throws java.lang.Throwable {
if(getTestMethodName().equals("testOne"))
testOne();
else if(getTestMethodName ().equals("testTwo"))
testTwo();
}
Building a Test Suite
The two following methods demonstrate how to build a test suite from a J2ME test
case.
public Test suite() {
return new TestSuite(new TestOne().getClass(),new String[]
{"testOne"});
}


public static Test suite() {
TestSuite suite = new TestSuite();
suite.addTest(new TestMine().suite());
suite.addTest(new TestMine2().suite());
return suite;
}
Integration of Objects Under Test
The objects under test must belong to the test class and must have been initialized in
the setUp method.
Java Test Reports
Understanding Java Test Reports
Test reports for Component Testing for Java are displayed in Test RealTime's Report
Viewer.
The test report is a hierarchical summary report of the execution of a test node. Parts
of the report that have Passed are displayed in green. Failed tests are shown in red.
187