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.
-
Add a field Condition to your Data Set (either in UI or tab separated text file to import).
-
Define the conditions that determine if a particular row is relevant or not.
-
At run time the actual values of variables are replaced in the expression, and is evaluated for true or false.
Rules for specifying Condition:
-
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. -
Single space is the delimiter between the operands and operators used in condition expression. For example:
@test > 10
,@name = 'abc' OR @name = 'xyz'
. -
Following values in Condition will evaluate to TRUE:
true or TRUE or no value
(blank), whereasfalse or FALSE or 0
(zero) evaluate to FALSE. -
Following operators are supported:
>,<,=,<>,>=,<=, AND, OR
. -
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
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.