Data-driven testing

Learn how to run the same test with different data

Data-driven testing lets you define parameters in your tests and use them in any step. You can define multiple ordered data sets and have the test run against each set separately using the Testim CLI.


When using data sets, previous data will not be automatically removed from test until explicitly removed.

Popular use cases for Data Driven Testing

  • Run a signup test with different data - when you want to test your signup page with different user name and password, you can use Test Data and Conditions to build one test in Testim that will run several times with different usernames and passwords (negative or positive)
  • Read\inject data from a database - when you want to inject data into a database and then pass the data that was generated by the test. To generate the data you can use Testim CLI hooks and after the injection of the data was successfully completed, you can pass the data to your test.

Adding test data to your tests

Test data can be added to a test in three ways:

  • Through the visual editor (UI) - test data is added through the Test Data property in the Setup step. A Data Set is defined in JavaScript and multiple ordered Data Sets are defined by a JS Array literal of objects. See Configuring a Data-driven Test From The Visual Editor.
  • Through the Config file - the configuration file is a common JS containing all the required parameters to run your test suite and run hooks. Through one of these hooks it is possible to add test data to specified tests. This data set can override the dataset that was defined in the visual editor. See Configuring Data-driven Tests Using the Config File. The test can be run using the CLI, while adding a flag to use the config file in this run.
  • Through an external file- Test data from external sources (e.g. CSV, DB etc.) can be passed to one or multiple tests using the Config file. The test can be run using the CLI, while adding a flag to use the config file in this run. See Configuring Data-driven Tests Using Data From an External Source

Viewing test runs with different data sets

  1. Go to Suite runs view and go to the suite that you just run.
  2. You can see the run result with the Data Set per test when you hover the "i" icon in the right side of the test and then click the See Data Set button.

Setting Cookies

If you need cookies to be loaded before your system loads or you need cookies for a particular test, you can also define cookies using the reserved cookies parameter. The cookies parameter can be added through the visual editor and through the Config file.


Read all about the setting cookies options here.