Page tree
Skip to end of metadata
Go to start of metadata

With the help of looping functionality, now you may execute multiple iterations of a test case. To setup a loop, please follow the steps below:

  1. First create a test case which you think, will be part of loop. Skip this step, if test case is already created.
  2. Simply go to Details sub-tab of this test case and provide value for loop source field. More information regarding loop source is provided below.
  3. Once you submit the loop source then a loop indicator will appear on the header of the test case.

Loop Source:

Loop source can be any of the following:

  1. Number Value
    If the loop source is a number value then the test case inside loop will be executed specified number of times. 
  2. Variable Name 
    1. If the variable's value is a number then the test case inside loop will be executed n (n is the variable's value) number of times.
    2. If the variable's value is an array then the test case inside loop will be executed n (n is the length of array) number of times.
    3. Otherwise the variable's value will be treated as boolean 
      1. if the variable's value is truthy then test case inside loop will be executed.
      2. Otherwise test case inside loop will loop will not be executed.
  3. Boolean Value
    1. If the value is false then test case inside loop will not be executed.
    2. Otherwise test case inside loop will be executed.

Loop Index:

Test Case inside loop can access the current loop index with the help of a special variable "$" (without double quotes). Loop index can be accessed in the following ways:

  1. Using variable notation {{$}}. Wherever this variable is specified that will be replaced with the current loop index starting from zero.
  2. If the loop source contains variable name (say {{data}}) which value is an array then individual array item can be accessed using $ as below:
    {{data.$.xyz}}

Usage Scenarios:

Data Driven Testing:

Few Caveats:

  1. Request Method cannot be defined as dynamic for the loop test case.

  2. Different set of request query parameters for each iteration cannot be defined for the loop test case. However if you are using same set of query parameters then values can be dynamic for each iteration.
  3. Similarly different set of assertions cannot be defined for the loop test case. However if you are using same set of assertions then values can be dynamic for each iteration.

 

 

 

 

  • No labels