Creating a data file
A data file is an XML document that contains three separate sections, each of which represents a different type of parameter. Test data should be passed from a data file to the automation scripts instead of hardcoding the data directly in the automation scripts. Therefore, one data file should exist for every test script. Using a data file will allow you to test an aspect of your storefront with many different sets of data while only having to write a single automation script to do so. The name of the XML data file should be identical to the test script. The framework automatically selects the data file based on the test script name.
The
three types of parameters include:
- Environment parameters
- Since each automation script has its own data file, the test cases within an automation script can globally use any environment parameter that has been defined.
- Input parameters
- At the start of every test case, the automation script calls the
setDataLocation
method to specify the test node and data block that contains the input parameters. The parameters include any values that are needed to test the storefront. For example, the test cases that verify the sign-in functionality of the store will reference a corresponding test node and two different data blocks; one data block to test a successful sign-in and another to test a failed sign-in. - Output parameters
- When a test case has an expected result, such as displaying a specific message, the result should be passed as an output parameter that validates the test case. The output validation parameters for a test case should be contained in the same data block as its input parameters.