Referencing Data Set Fields in Test Scripts
Apart from associating test scripts and data sets, data set fields also need to be referenced in test scripts. When you create a data set, you can name a data set using the Add Fields button as follows:
Applet name|Field name
When you do this, instead of using the input value, you can reference the data set as follows in the test script:
#
You need to ensure that the target object matches the Applet name|Field name naming
format. It's recommended to use a meaningful short name when naming a Data Set column in
the input, such as: #<name of column>
. For example, where Age is the
name of the data field in a data set, you name it #Age
.
To reference a data set field in a test script
-
Navigate to the Release screen, then the Test Scripts view.
-
Select a record, and drill down on the record name.
-
Click a Test Step record.
-
Use the following examples to edit the Test Step record:
-
In Launch Test Step, if the associated data set has a User Name field with the value Employee, update this field to
#Employee
. -
In Input Value Test Step, if the associated data set has a Value/Variable field with the value Revenue, update this field to
#Revenue
.You can apply the same changes to the ItemRN and AppletRN fields.
-
Recommendations to consider when you reference a data set in a test script include the following:
-
The application performs no validation on referenced or unreferenced fields.
-
You can append the dollar sign ($) to your referenced field name to include a time stamp at run time. For example, the field
#Name$
appends a time stamp to values from the Name column in data sets.However, if a data set value already has a dollar sign appended to it, no timestamp is provided; and if the data set is balnk, then a field such as
#Name$
results in just the time stamp value. -
#@<variable name>
is supported to dynamically reference Data Set columns, which resolves to column name matching the value of the variable. For example,#@Var @Var
can contain Data Set field name. -
Data set field names cannot begin with
'@'
. -
From the data set, you can reference the User Id in Launch Action. For example,
#UserId
where User Id is a field name in the data set.