Configuring a Data-driven Test From The Visual Editor

Test Data can be added to a specific test in the UI by choosing "Test Data" in the Setup step's properties panel.
To add Test Data to a test:

  1. In the test's Setup step (the first step), click the Show properties button ().
  2. Click on Test Data.
  3. Define the data set in the JS editor
    This is the dataset we defined in the example:
return [{
  "username": "tomsmith",
  "password": "SuperSecretPassword!"
},{
  "username": "david",
  "password": "SecretPassword?"
}];

πŸ“˜

The brackets must remain in the return line.

πŸ“˜

Only when you run your test from Testim CLI, scheduler or local suite run, the test will run multiple times, in order, each time with a different Data Set.

19201920
  1. Click the Show Properties button () on the the step(s) that you want to add the data set to. For example, in the "set username" and "set password" steps.
  2. In the Text to assign field, replace the existing text with the name of the parameter. For example, in the Set username step, enter the username parameter.
11811181
  1. Run your test.
    The test will run with the first Data Set:
12261226

"username": "tomsmith", "password": "SuperSecretPassword!"

Running the test from the editor will only run the first data set. When you want to run additional data sets, you will need to use the CLI, which includes the beforeSuite hook that overrides test data provided in the UI, or the Scheduler.

Adding test data by uploading a CSV/Excel file

It is also possible to upload the test data using a CSV or Excel file. After the file is uploaded its data will be added as the test data according to the following structure:

  • First row - parameter name
  • Consequent rows - includes the data set.

πŸ“˜

As part of this method the uploaded data will not be updated if the file has changed. Every update will require uploading the file again. In contrast, when using the config file method (see, Data Driven tests using data from an external source), the file will be automatically parsed on every run.

To add test data by uploading a file:

  1. Prepare an Excel/CSV file according to the structure mentioned above.
349349
  1. In the test's Setup step (the first step), click the Show properties button ().
  2. Click on Test Data.
  3. Click Upload File and select the file you have created.
358358
  1. The uploaded data is displayed. You can modify this data if needed.
473473
  1. Use the parameters in the test steps as explained above.

πŸ“˜

Only when you run your test from Testim CLI, scheduler or local suite run, the test will run multiple times, in order, each time with a different Data Set.

πŸ“˜

When updating the test data in the editor You can revert back to previously saved test data through the revisions history. When changing the test data in a branch, while merging you will need to decide if you want to apply the change on the merge as well.

  1. Use overrideTestData in the beforeSuite to pass test names and their data sets as shown below.