background image
<< JUnit Overview | Test Class Primitives >>
<< JUnit Overview | Test Class Primitives >>

Java Test Harness

Test RealTime - User Guide
·
TestDriver.java: is the main test driver class
·
Test
<Class>
.java: is the test class derived from the TestCase class
·
<Class>
.java: is the actual class under test.
In Component Testing for Java, all classes have the excluded from build tag except
for the main TestDriver.java class.
Note JUnit test harnesses that were manually imported into Test RealTime
and not created through the Component Testing wizard may not display the
correct yellow icons. This is not an issue as long as all files are excluded from
the build except for the main test driver class.
Java Test Harness
Component Testing for Java generates a full Java test harness based on JUnit-
compliant classes for J2SE and J2ME framework.
The Java test harness can be used for single thread component testing, using the
following main JUnit classes:
·
TestSuite
: This class is a container for multiple test classes derived from
TestCase
·
TestCase
: The basic class that is derived into a series of user-defined test classes
·
TestResult
: This class returns the results of a given test class:
·
Unexpected errors: unwanted exceptions
·
Failed assertions: produced by the JUnit
assert
test primitives
·
Failed verifications: produced by the extended
verify
test primitives
The list of extended
verify
test primitives can be found in the Test RealTime
Reference Manual.
Please refer to the JUnit documentation for further information about JUnit
assert
primitives as well as general JUnit documentation. This can be found at the official
JUnit Web site:
http://junit.sourceforge.net
Test Harness Constraints
Component Testing for Java complies with most JUnit test cases. However, it
introduces the two following constraints:
·
User test classes must derive from the
TestCase
class, or from a
TestSuite
that
contains one or several
TestCase
classes
·
The test harness cannot be applied to multi-threaded Java components
178