Work with execution control constructs

Execution control constructs are conditions, loops, and logical steps.

Add conditions

To include a condition into the test, use the Condition icon in the top toolbar. You can use conditions to change the flow of the test according to a set criteria.

Each condition splits the execution into two possible branches:

  • On Success if the condition evaluated is successful
  • On Failure if the evaluated condition was an error or unsuccessful

Conditions are evaluated according to the result of the statement, which should be a validation (such as Find or Textcheckpoint). Therefore, ensure that the function to be evaluated is located in the statement. (Notice that the results used to evaluate the condition can be from any function, including Wait.)

The statement determines which branch of the condition will be taken. Every condition can have a maximum of one command set as a statement. Commands that have nested validations cannot be added as a statement. Not setting a statement means the condition will not work as expected. When a command is set as a statement, we automatically update its On Error policy.

A conditional set of commands (On Success or On Failure) can be left blank and if met will cause the test to continue to the next step after the condition statement.

Example    

The following image shows a sample test with a simple condition.

If the Application.Element.Find command succeeds, the Application.Element.Click command on line 5 will run, followed by the Comment command on line 9. The following image shows a successful run.

If the Application.Element.Find command fails, lines 7, 8, and 9 will run instead. The following image shows a failed run.

Create loops

Use loops in the test to repeat a set of commands a predetermined number of times.

You can also select the iteration type as a DataTable instead of repetitions. For automated commands, each iteration uses the data of the active row of the DataTable.

To add a loop to your test, use the Loop icon on the top toolbar.

When repetitions are specified, the system will iterate the command according to the defined number.

When a DataTable is selected, the system will iterate the command as per the rows of the selected DataTable.

Use logical steps

Logical steps are created by combining a group of commands. A logical step can also be included within another logical step.