Editing JUnit test suite
This section describes how to edit your JUnit test suite.
You must have created a JUnit test suite.
- In the Navigator double-click the test suite entry to open the JUnit Test Suite Definition dialog box as shown below. The test suite opens in the Overview tab with the three edit areas (General Information, Source Information, and Test Methods) expanded.
- The General Information area displays the test suite's name, an optional description, test type, and name of the file containing the test suite. You can edit information appearing in boxes.
- The Source Information area displays the name of the Java package that contains the test suite's executable Java code, and the name of the Java class that implements the test suite. You can relocate the code to a different package by clicking Browse under the Package Name box.
- The Test Methods area lists the individual tests that make up the test suite. Click one of the test methods or More to display the Test Methods view, as shown below.
To change the name or description of a test method, select the method and enter new text in the Name or Description boxes. Use the Add and Remove buttons to add test methods and to remove existing methods. Use the Up and Down buttons to change the order of methods. Note that this does not change the order in which the test methods are executed. Use the Behaviors tab to control the execution order.- Click the Behaviors tab to display the Behaviors view, as shown below.
Behaviors let you control the order in which test methods are run; you do this by specifying invocations and loops. For example, in the figure shown above, test 1 and test 2 run inside Loop 1. Use the Number of Iterations box to specify how many times to execute the loop. With Synchronous checked and more than one iteration specified, the loop iterations execute in sequence. With Synchronous unchecked and more than one iteration specified, the loop iterations execute simultaneously.- Use the Up and Down buttons to change the order of invocations and loops. Use the Add and Remove buttons to add and remove loops and invocations. After you create a loop you can add an invocation to it by right-clicking the loop and selecting AddInvocation. The Test Invocation dialog box, shown below, appears.
The top pane lists test methods in the test suite. The bottom pane lets you navigate to test methods in other test suites in your workspace. You can nest loops and create invocations that are outside of any loop.- When you are finished editing the test suite definition, click the X in the tab to close the definition.
Parent topic
JUnit test overview
Previous topic: Creating a JUnit test suite
Next topic: Generating Java code