Importing a JUnit Test Campaign

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:

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.

Test Harness Constraints

Component Testing for Java complies with most JUnit test cases. However, it introduces the two following constraints:

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:

  1. In the Project Explorer, select the Project View and right-click the Project node.

  2. From the pop-up menu, select Add Child and Component Testing for Java.

  3. Enter the name of the new Java test node.

  4. In the Project Explorer, right-click the Java test node.

  5. From the pop-up menu, select Add Child and Files.

  6. Locate and select the classes under test and the JUnit test classes.

  7. Click OK.

  8. Exclude from the build all Java classes, except the main test driver class.

Related Topics

Java Test HarnessManually Creating a Test or Application NodeAdding Files to the ProjectExcluding a Node from a Build