This topic describes how you can use the
Test Logic Designer to add decision logic to a visual test. For information on how to add decision logic test steps directly to the visual test,
see
Inserting Decision Logic Using Decision Test Steps.
-
Open the visual test.
-
Right-click on the test step or the sequence of test steps that you want to include in your test logic.
-
Choose
.
The
Test Logic Designer wizard opens.
-
Click
Next.
-
From the
Select a Logic Type page, select the type of decision logic.
- The property of a control – Creates decision logic that runs a sequence of steps based on the property of a control in your test application. For example:
If propertyValue > 2 then Do step 3 To step 4 End If
- Whether a control exists - Creates decision logic that runs a sequence of steps based on whether a specified control exists or the specified control
does not exist. For example:
If "Button" Exists Is Equal to True Do Step 3 To Step 4 End If
-
A variable defined in this visual test – Creates decision logic that runs a sequence of steps based on the contents of a local variable defined in your visual test.
For example:
If stringVar = "red" then Do step 3 to step 4 End If
- Advanced logic – Skips the
Defining the Condition step of the wizard and creates advanced decision logic using the
Condition Designer. For example:
If stringVar = "red" AND numberVar = 10 then Do step 3 To step 4 End If
-
Click
Next.
-
If you have selected
The property of a control, the
Define a property-based condition page opens.
-
Expand the
Identify a Control menu to the right of the
Name of control field.
-
Expand the
Identify a control menu and select one of the following:
- Application Under Test – Click this button to identify a visible control directly from the application under test.
- Screen Preview – Click this button to identify a control directly from the
Screen Preview, if the application under test is not available.
- Identify Object Dialog – Click this button to use the
Identify Object dialog box to identify a non-visible control. The
Identify Object dialog box additionally enables you to edit the locator of the control.
-
In the
Select a property table, select the property.
-
From the
Select the condition list, select the conditional logic to apply to the property of the control.
-
In the
Expected value field, specify the value that the property is expected to have.
-
Click
Next.
-
If you have selected
Whether a control exists, the
Define an exists condition for the control page opens.
-
Expand the
Identify a control menu and select one of the following:
- Application Under Test – Click this button to identify a visible control directly from the application under test.
- Screen Preview – Click this button to identify a control directly from the
Screen Preview, if the application under test is not available.
- Identify Object Dialog – Click this button to use the
Identify Object dialog box to identify a non-visible control. The
Identify Object dialog box additionally enables you to edit the locator of the control.
-
Select
Control exists to verify that the control exists.
-
Select
Control does not exist to verify that the control does not exist.
-
Type a value into the
Timeout field to specify how long
Silk Test Workbench should wait for the control to appear or to disappear.
The default timeout is 0, which means
Silk Test Workbench does not wait for the control to appear or to disappear.
-
Click
Next.
-
If you have selected
A variable defined in this visual test, the
Define a variable-based condition page opens.
-
Select a pre-defined local variable from the
Select the variable list.
For a variable to appear in this list, you must include the local variable in your visual test. To add a new local variable
to the visual test, click
New.
The
Evaluate as field, displays the data type of the selected variable.
-
Select the comparison operator to apply to the variable from the
Select the condition list.
-
In the
Expected value field, specify the value that the variable is expected to have.
-
Click
Next.
-
If you have selected
Advanced logic, click
Next.
-
The
Build the Decision page opens. Specify the conditional logic and sequence of steps to run when the result of the conditional logic is true.
Tip: Rest your pointer on a link to display a ToolTip containing the full link description.
-
Click the link to the right of the
If statement to specify the conditional logic in the
Condition Designer.
-
Click the link to the right of the
Do step statement to specify the first step in the sequence of steps to run.
-
Click the link to the right of the
To step statement to specify the last step in the sequence of steps to run.
-
Click
Add Else If to insert additional conditional logic.
Click the provided links to open the
Condition Designer and specify the sequence of steps to run when the condition is true.
-
Click
Add Else to insert additional conditional logic.
Use the provided links to specify the sequence of steps to run when the condition is false.
-
Click
Delete to remove any additional conditional logic and sequence of steps.
This button only appears after you insert additional conditional logic.
-
Click
Next.
The
Summary page displays the test logic that you have defined. Uncheck the check box at the bottom of the page to prevent the
Summary page from appearing on subsequent uses of the
Test Logic Designer wizard. Checking or un-checking this check box updates the
Show Test Logic Designer summary screen general option. For more information, see
Modifying General Options.
-
Click
Finish to insert the test logic into the test steps of your visual test. To modify the test logic, click
Back and make the desired changes.
The test logic is added to the visual test.