Adding conditional logic
You can add IF-THEN conditional logic around portions of a test/compound test or a schedule, in this context, is used to refer to VU Schedule and Rate Schedule to make those portions run if a specific condition is met.
Before you begin
A conditional block can run portions of a test depending on the value of a reference or field reference. The reference or field reference must exist in the test and precede the conditional block. If the reference or field reference that the conditional block uses for input does not exist, you must create the reference as explained in Creating a reference or field reference.
About this task
The test might already contain the test elements that are to be run. If the test does contain the elements to be run, you must select the requests in step 2 of the procedure, and click Insert. The following instructions explain how to add a conditional block that contains such requests.
Otherwise, you can create an empty conditional block at the end of the selected item (test or request). Click the object, and then click Add.
Procedure
-
In the Test Navigator, browse to the test and double-click it.
The test opens. You can also open a compound test or a schedule.
- Click a page or page request.
The conditional block is inserted before the selected item. By completing step 5, you can move the selected items into the block.
-
Press Shift or Ctrl when clicking to select
multiple pages or requests to be moved into the block.
In step 6, if you add an Else block, you can select one or more of these items to be moved into the Else branch.
-
Right-click the item and select
.A prompt Would you like to move selected objects into the new IF? is displayed.
- Click Yes or No.
The If block is inserted into the test. If you click Yes, as shown in the example, the items that you selected are moved under If in the Test Contents area. The following example shows an If block with an HTTP test.
- To add an Else block:
-
In the Test Element Details area, under Condition, add
conditions:
- In the Test Element Details area, under Options, choose the required comparison type by selecting or clearing the check boxes.