Work with conditions | Tutorial
Watch this short video to learn about validations and conditions. Validations check whether a scenario is true or not. They result in a pass or fail value. Conditions are IF statements that can take the test in one direction or another. They are helpful if you need to create more complex decision trees.
For your convenience, we have also listed the steps for the main procedures below the video.
To add a validation step on the fly
- Make sure the execution is running and on a breakpoint.
- If the execution is not on a breakpoint, add a breakpoint: Click the circle to the left of a test step and then wait until the test has reached that step and paused.
- In the left pane, click Add step.
- Select Validations and then the action you want to validate, for example Check URL.
- In the Add Flow Element dialog box, provide the relevant information. For example, if you check a URL, select the relevant URL from the Check URL list.
- Click ADD.
- Verify that the validation step was added to the left pane.
- If the step requires locating an element on the screen, you get prompted to identify the element in the browser before the test can continue. Click the element.
The test should now proceed and display a checkmark next to the new step.
For more information, see Validate an action.
To add a conditional step on the fly
- Make sure the execution is running and on a breakpoint.
- If the execution is not on a breakpoint, add a breakpoint: Click the circle to the left of a test step and then wait until the test has reached that step and paused.
- In the left pane, click Add step.
- Select Validations and then the action on which you want to place a condition.
- In the Add Flow Element dialog box, under Step type, change Validation to Condition.
- Provide any additional information required. For example, if you check the text of an element, provide the name of the element and its value.
- Click ADD.
- Verify that the conditional step was added to the left pane. It should be followed by a Waiting to resolve condition element.
- If the step requires locating an element on the screen, you get prompted to identify the element in the browser before the test can continue. Click the element.
The test should now proceed and display a checkmark next to the new step, along withTRUE or FALSE, depending on the resolution of the condition. - Add any additional steps as needed.
To connect a conditional step to an alternative test scenario
- Click View on Canvas to open the test on the canvas. You need to use Advanced Mode to connect a conditional step to an alternative test scenario.
- In Advanced Mode, locate the conditional step. One side of the step should already be connected to a next step. This connection was created on the fly in the previous procedure.
- Grab the handle of the step's side that is not connected to a next step and do one of the following:
- If the required step already exists, drag a line from the conditional step to the top of the required next step until a red rectangle appears. This indicates that the line has connected.
- If the required step does not yet exist, drag a line from the conditional step and drop it anywhere on the canvas. The context menu opens, letting you create a new step. Select an action and proceed to create the new step. For more information, see Add a step through the canvas.