Component Testing for Java
JUnit is becoming an industry standard in the field of testing Java software.
Rational Test RealTime can import your existing JUnit test campaigns. This requires manually building a new Java test node that contains:
The classes under test
The test classes derived from TestCase
All other test harness components
After this, you must ensure that only the main test driver class is passed on to the Java compiler. To do this, exclude all other classes from the build.
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
You must be especially aware of these constraints when importing existing JUnit test classes into Rational Test RealTime.
To import an existing JUnit test harness:
In the Project Explorer, select the Project View and right-click the Project node.
From the pop-up menu, select Add Child and Component Testing for Java.
Enter the name of the new Java test node.
In the Project Explorer, right-click the Java test node.
From the pop-up menu, select Add Child and Files.
Locate and select the classes under test and the JUnit test classes.
Click OK.
Exclude from the build all Java classes, except the main test driver class.
Related Topics
Java Test Harness | Manually Creating a Test or Application Node | Adding Files to the Project | Excluding a Node from a Build