Loops serve several needs in RVL:
- Iterate through Maps to make data-driven testing easier.
- Allows you to repeat a set of actions for a given number of iterations.
- Lets you repeat a loop body while some Condition is satisfied.
A Map allows both reading script data from the table defined in the same script or from external data source such as spreadsheet, file or database. Once a Map is defined, the loop is the simplest way of traversing it.
Where MapName should be name of the map declared earlier in the same script.
The loop goes through either the map rows or through the map columns depending on the type of map:
Databasetype of Map, the loop goes through rows. I.e. 1st iteration points to 1st Row, then 2nd iteration points to 2nd row etc.
Tabletypes of Map, the iteration goes through the columns.
VarName is an optional name of variable. It may be avoided if the goal is just to do specified number of iterations. If VarName is set, then the corresponding variable is assigned with the
fromvalue and incremented up to the
tovalue throughout the loop. If VarName refers to an existing local or global variable then it is used, otherwise a local variable named VarName is created.
from initial value of the loop variable
- to final value of the loop variable
- step optional, default is 1. Loop step to increment in each iteration.
Loop repeats while condition is satisfied (i.e.