Loops in useMango™ allows you to repeat specific test steps within a test. Whether you need to run steps a fixed number of times or iterate through a list of values, this feature simplifies repetitive tasks and ensures a seamless testing process. It enhances flexibility and reduces the effort required to automate scenarios that involve repeated actions.
In the useMango™ Test Designer
Fig: Adding a loop
Once added, the steps inside the loop will repeat and execute according to the specified loop count or loop table.
Nesting of loops is supported using a composite component. While you cannot directly add a loop inside another loop in the test designer, you can achieve this by placing a loop within a composite component and including it in your main loop.
After adding a loop, double-click on it or hover over the loop and click on the spanner icon to configure its behavior. You will be prompted to choose one of the following options:
Fig: Loop configure options
The usage of each option will depend on the specific use case of the test being performed.
To add steps within the loop either right-click on the connector line under the loop and select Insert Step, or select the loop and use the Insert an element option from the toolbar and select Within.
Loop Count is used when you need to repeat the same action a specific number of times. This option is helpful for tests where the number of repetitions is fixed and doesn’t depend on external data. It’s a simple and effective way to perform repetitive tasks, such as verifying consistent behavior or testing scenarios multiple times to ensure reliability.
Fig: Selecting Loop Count
The loop count number should be greater than or equal to zero. Setting the count to zero means the loop will not execute.
The Loop Table lets you repeat steps in a test using different data from each row of a table provided to it. In each iteration, the loop picks a row of data corresponding to the loop iteration index, allowing you to perform the same actions with different values each time.
In order to use a loop table, you will need to create a Table type data, which can be a test variable, project variable, environment variable or test parameter. For instructions on editing table data, refer to the Data Types in useMango™ page.
Fig: Assigning a table to the loop table
Table headers are the first row in a table that defines the labels for each column. They act as identifiers for the data in that column. For example, if a table is used to store information employee data, the headers could be First Name, Last Name, Age, Email, etc with the rows underneath containing the corresponding data for each person.
Fig: Table view Fig: Viewing table headers
Assigning table headers to steps ensures that each step receives a value from the row corresponding to the current iteration.
To assign table headers, ensure that a table is assigned to the loop first.
Click on the > icon next to the table data to view the table headers.
There are two ways to assign table headers:
a. Drag and drop the table headers into the steps inside the loop.
b. Type the header name into the step value field and select it from the dropdown.
Fig: Assigning table headers to steps in a loop
Fig: Switching from loop table to loop count