Using data sets
Data sets are used to provide values for a sequence of action lines. To start such a sequence from within a test, use the use data set action.
The use data set action has two arguments:
- The name argument of the data set must contain the path of the data set, with the forward slash (/) as the path separator. This path always starts with the forward slash (/), which corresponds to the Data subfolder of the project.
- Example
- A data set, CRR, is located directly under the Data node, without folders. The path is:
/CRR
- A data set, zipcodes, is located in the folder address data under the Data node. The path is:
/address data/zipcodes.
- A data set, CRR, is located directly under the Data node, without folders. The path is:
- Example
- The filter argument can contain either a filter expression, or the name of a filter that has been defined (or will be defined) in the data set.
At the end of the sequence of action lines, use the action repeat for data set. During the test run, this action causes execution to loop back to the use data set line for as long as there are more vectors from the data set available to be used.
The following example demonstrates how a data set can be used to enter a series of reservations for rental cars. In this example, the various steps in the registration process are followed for each vector supplied from the data set. In this case the values are only used as input, but a data set can also contain expected values, for comparison with actual results.
To apply the long filter (a filter named long, as specified in the data set from the earlier example), place it as a value in the filter argument of use data set. Now only those vectors matching this filter’s criteria are used for the test.
Instead of using a filter by name, as defined in the data set file, you can also specify a filter expression directly within the filter argument.