Looping allows a portion of test logic to repeat multiple times. You insert a loop in test logic by selecting the "Loops" option from the command menu. Logic editor supports 3 types of loops.
- Repeat loop: Use this loop when you need to loop for a fixed number of times in the logic. Repetition is unconditional and runs exactly for the given number of times.
- Do-While loop: Use this loop when the repetition is based on a condition being satisfied. Statements inside the loop block start executing first, and then the condition gets evaluated. If the condition (based on required command) gets evaluated to true, the loop will continue to run. This loop is guaranteed to run at least once, as the condition gets evaluated after the initial execution.
- While loop: This is similar to do-while loop, except that the condition gets evaluated before the statements inside the block get executed. In some situations, the loop may never gets executed if the condition fails in the first instance.
When you use do-while or while-do loop, you will be prompted to select a condition command just like you would do when inserting a conditional statement.