Combine Multiple Data Sources in Katalon Studio
This article shows you how to execute your automation test using predefined test data from multiple sources.
Requirements
You need an active Katalon Studio Enterprise license. To learn more about activating licenses, you can refer to this document: Activate Katalon license.
Expand the data binding section in Katalon Studio
To expand the Data Binding section, go to your test suite, click Show Data Binding. This feature help you bind the predefined test data files and manage variable binding with the Test Suite you want to run.
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 in Katalon Studio
Adding data sources in Katalon Studio
-
In the Test Data table, click Add to add data file(s). A Test Data Browser dialog opens.
-
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.
Modify data range in Katalon Studio
To specify the data range, double-click on the cell under the Data Iteration column of each data files.
Option | Description |
---|---|
Run all rows | To 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:
|
Manage test data relationship in Katalon Studio
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:
Relationship | Example |
---|---|
One to One | Given there are two data sets as below: Then the final data set used for test execution will be:
|
Many to Many | Given there are two data sets as below: Then the final data set used for test execution will be:
|
One to Many | Given there are two data sets as below: Then the final data set used for test execution will be:
|
One to One to Many | Given there are three data sets as below: Then the final data set used for test execution will be:
|
Variable binding table in Katalon Studio
After adding the test case into the test suite, Katalon Studio automatically imports all variables of the selected test case into the Variable Binding table.
-
Katalon Studio allows you 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.
-
In the Test Data column, click on each row to choose the test data files for execution.
-
In the Value column, click on each row to specify the data field in the selected data file.
-
Save the test suite when you finish.
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 in Katalon Studio
This option allows you to associate the variables with other scripting values.
Highlight rows No. 1 and No.2 > click Set Type > select Script Variable.
Specify the data used in the Value cell.