JUnit Test Suite Editor
The JUnit Test Suite Editor can create and remove methods on a JUnit test, and control
how those methods are invoked.
Double-clicking on a JUnit test suite file opens the TPTP
JUnit Test Suite editor. Three tabs are visible: Overview, Test Methods, and Behavior.
Overview (as above) records various properties:
the Name of the TPTP JUnit Test (SimpleTest in this example); its Description
('An example TPTP JUnit Test.'); its file path
(/javaProject/junit/samples/SimpleTest.testsuite); the Java Package
Name involved (junit.samples); and
the Java Class Name (SimpleTest). The Java Package Name can
either be typed in directly or the Browse button used to navigate
to it. To open the generated source code for the TPTP JUnit test, click Open. Alternatively, right-click
the TPTP JUnit test in the
and select Open Source or Alt+Shift+T, O.
Test Methods Tab
If the Test Methods tab is selected then the view switches
to the Test Methods section of the editor
Selecting a test method reveals its Name and Description
(if present) in the right-hand pane.
To alter a test method name, select the test method
(in the left-hand pane) then edit the Name text box. To alter a
test case description, select the test method (in the left-hand
pane) then edit the Description
text box. Use the Add and Remove buttons to add test methods and to remove
existing (selected) test methods respectively. Use the Up
and Down buttons to change the order of
test methods. To open the generated source code for the test method, select the test method and click Open. Alternatively, right-click
the test method under the TPTP JUnit test in the
and select Open Source or Alt+Shift+T, O.
Within the Overview tab view, if the Implement Test
Behavior as code check box is checked then
the behavior is purely code-based that is, the test methods will be executed
exactly as presented in the Test Methods view. This is the position with
respect to TPTP JUnit tests that have been created as a result of importing
JUnit tests into a TPTP JUnit test.
If the Implement Test Behavior as code check box is cleared
then an additional tab Behavior becomes available. (Note that the
behavior feature should be used only for TPTP JUnit tests that have been
The Behavior tab allows you to specify the frequency and
order in which test methods are run. This is done via invocations and loops:
invocations allow you to specify which test methods you wish to run, and
in which order; loops allow you to embed the chosen test methods within
a loop which can be iterated one or more times. Behaviors can contain a
mixture of invocations and loops. To set up a single loop:
Select the Behavior tab, click on the Add...
button and select Loop.This will setup a behavior under the control of a single
loop. The Name entry field is filled with the default value Loop 1 and the Description is empty.
By default, the number of iterations of a loop is 1. This
can be changed via the Number of Iterations
check box which specifies the number of loop iterations.
is checked for a loop, each iteration of the loop is executed sequentially. That is, the invocations and nested loops contained
in the loop are executed, based to their Synchronous property, for an
iteration before continuing to the next iteration. Conversely, when Synchronous is
unchecked for a loop, the iterations of the loop are executed simultaneously. That is, the invocations and nested loops contained
in the loop are executed, based to their Synchronous property, for all iterations
at the same time.
is checked for an invocation, the invocation is executed sequentially. That is, the invocation is executed before continuing
to the next invocation or loop. Conversely, when Synchronous is unchecked for an invocation, the invocation
executed simultaneously. That is, the invocation is executed at the same time as the sibling invocations and loops.
The Up and Down buttons are
used to alter the relative positions of invocations and loops. The Add
and Insert buttons are used to add selected loops or invocations while the Remove button deletes selected
loops or invocations.
Loops can be nested, and invocations can exist outside of
Typing ALT-k or ALT-s
moves the editor cursor to the beginning of the text boxes for the Package
Name or Class Name fields respectively.
Adding test methods