Combine multiple data sources

This article shows you how to execute your automation test using predefined test data from multiple sources.

Go to your test suite, click Show Data Binding to expand the Data Binding section. This feature help you bind the predefined test data files and manage variable binding with the Test Suite you want to run.

Expand data binding section

In the extended Data Binding section, there are two tables:

  • Test Data: Specify here the data files for your test execution.
  • Variable Binding: This displays all variables of the selected test case. See also Test case Variables.

Test Data Table

Adding data sources

  1. In the Test Data table, click Add to add data file(s). A Test Data Browser dialog opens.

    Add data files
  2. Select a combination of data files you wish to use for variable binding in the Test Data Browser dialog. Click OK. The selected test data files appear in the Test Data table.

    Test Data Browser Results after adding data files

Modify data range

To specify the data range, double-click on the cell under the Data Iteration column of each data files.

Data Iteration
OptionDescription
Run all rowsTo use all the data rows in the data file in the test execution.
Run from row ... to row ...To use the data range from a particular row to another particular row in the data file during the test execution.
Run with specific rows

To use the specific data rows in the data file during test execution. You can use comma and hyphen characters to define the rows.

For example:

  • to use three data rows (row 1, row 2, row 3), enter: 1,2,3
  • to use six data rows (row 1, row 2, row 3, row 4, row 5, row 9), enter: 1-5,9

Manage test data relationship

To toggle between One and Many, click on the cell under the Type column of each data files. These types represent the relationship of multiple test data sources.

You can also further define the relationship among them as below:

Relationship Type Description
One To indicate the data set as 'One' in the relationship with the other data set.
Many To indicate the data set as 'Many' in the relationship with the other data set.

Therefore, we have the following combinations of data sets:

RelationshipExample
One to One

Given there are two data sets as below:

Manage Data Relationships One One

Then the final data set used for test execution will be:

  • John Marketing
  • Joe Sales
Many to Many

Given there are two data sets as below:

Manage Data Relationship One Many

Then the final data set used for test execution will be:

  • John Marketing
  • John Sales
  • Joe Marketing
  • Joe Sales
  • Mary Marketing
  • Mary Sales
One to Many

Given there are two data sets as below:

Manage Data Relationship Many Many

Then the final data set used for test execution will be:

  • John Marketing
  • Joe Marketing
  • Mary Marketing
  • Emily Marketing
  • John Sales
  • Joe Sales
  • Mary Sales
  • Emily Sales
One to One to Many

Given there are three data sets as below:

Manage Data Relationships One One Many

Then the final data set used for test execution will be:

  • John Marketing Executive
  • John Marketing Director
  • Joe Sales Executive
  • Joe Sales Director

Variable Binding Table

After adding the test case into the test suite, Katalon automatically imports all variables of the selected test case into the Variable Binding table.

  1. Katalon Studio allows users to Set Type for variables all at once if the variables have the same type. In this case, Username and Password have the same type as Data Column. Highlight both rows, click Set Type > Data Column.

    Set Data Type
  2. In the Test Data column, click on each row to choose the test data files for execution.

    Choose Test data for Data Type
  3. In the Value column, click on each row to specify the data field in the selected data file.

    Choose Value for Data Type
  4. Save the test suite when you finish.

    Final result

    During execution, the username variable looks for the Username column of the valid-accounts excel file while the password variable searches for the Password column of the valid-accounts CSV file.

Bind to Scripting value

This option allows you to associate the variables with other scripting values.

  1. Highlight rows No. 1 and No.2 > click Set Type > select Script Variable.

    Script Variable Option
  2. Specify the data used in the Value cell.

    Secify Value in Script Variable

Feedback