Dynamic Data Selection from Data Set

In order to selectively use a Data Set row at run time, use Condition field in your Data Set for the respective Data Set row. If the expression evaluates to true, the data in the row is used for the iteration, or else the iteration is skipped.

Use Condition expression to use or skip a Data Set row at run time. Default is to use all rows.

  1. Add a field Condition to your Data Set (either in UI or tab separated text file to import).

  2. Define the conditions that determine if a particular row is relevant or not.

  3. At run time the actual values of variables are replaced in the expression, and is evaluated for true or false.

Note: Syntax of expression is important and no prior validation of expression is performed.
Note: By default: If Condition field is not present, then the data set row is not skipped. Also, if Condition field is present, and the value is blank, then the data set row is not skipped.

Rules for specifying Condition:

  1. Ensure that the variable name does not have spaces. For example, variable @Test Variable is invalid, but @TestVariable or @testvariable or @test_variable are valid.

  2. Single space is the delimiter between the operands and operators used in condition expression. For example: @test > 10, @name = 'abc' OR @name = 'xyz'.

  3. Following values in Condition will evaluate to TRUE: true or TRUE or no value (blank), whereas false or FALSE or 0(zero) evaluate to FALSE.

  4. Following operators are supported: >,<,=,<>,>=,<=, AND, OR.

  5. Ensure the variables used in Condition are initialized with appropriate values, else the script fails with an error.

Examples for Condition:

  • @env = 'DEV'

  • @env = 'UAT'

  • @conf > 0 AND @conf < 50

Note: To initialize variables before a Test Script starts to run, use Parameters applet on Test Execution. Add Name and Value pairs.

For example: To initialize a variable @balance with value 100, add a Parameter with name as balance and value of 100.

Framework creates variables for each of the Name in Parameters applet, and initializes with corresponding Value.

Such parameters or variables can be directly used in Test Script and/or in Data Set Condition expression for comparison or input value.