Skip to main content

Manage data binding

Note:
  • An active Katalon Studio Enterprise license.
The data binding feature allows you to bind test data files with the variables defined in the test case and dynamically run tests with the bound test data. In Katalon Studio, you can perform data binding at the test suite level and the test case level. For more details on data binding at the test case level, you can refer to Data-driven testing at test case level.

This article will focus on the components of the extended Data Binding section in a test suite.

Once you have opened your test suite, click Show Data Binding to expand the Data Binding section.

The extended Data Binding section has two tables:

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

Test data table

In the Test Data table, you can add one or more data files, then modify the data iteration and manage test data relationship.

Add data files

  1. In the Test Data table, click Add to add data file(s).
  2. In the Test Data Browser dialog, select the data files to use for variable binding. Then, click OK.
The select data files appear in the Test Data table.

Modify data iteration

An iteration is a test case execution with a test data row.

After adding data file(s) to the Test Data table, you can modify the data iteration. Double-click the cell under the Data Iteration column of each data file.

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

The Type column in the table represents the relationship of multiple test data sources.

The data relationship can be defined as below:

TypeDescription
OneTo indicate the data set as 'One' in the relationship with the other data set.
ManyTo indicate the data set as 'Many' in the relationship with the other data set.

To toggle between One and Many, click the cell under the Type column of each data file.

Katalon Studio determines the relationships of data sets as follows:

RelationshipExample
One to One

Given there are two data sets as below:



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:



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:



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:



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 a test suite, Katalon Studio automatically imports all test case variables. You can select each test case to view the variables in the Variable Binding table.

ColumnDescription
Type

Set Data Type

  • Data Column: uses the data file's column header as value
  • Data Column Index: if you set the Value as 2, Katalon Studio will use the second column of the data file as value
  • Default: uses the default value of the test case variables
  • Script Variable: allows you to associate the variables with other scripting value

To set the variable types, click the cell under the Type column of each variable, then click Set Type.

Test Data

Choose Test data for Data Type

This column is enabled if you set Type as Data Column or Data Column Index. To choose the test data file, double-click the cell under Test Data column of each variable.

Value

Choose Value for Data Type

Here you choose the according column header of the data file for each variable.

If the variables and column headers of the data files share the same name, you can click Map All to quickly map them together.

During execution, the username variable looks for the username column, and the password variable looks for the password column of the valid-accounts data file.

Bind to script variable

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

  1. Highlight the rows you want to bind, click Set Type and select Script Variable.
  2. In the Value column, click the ... button to open the Variable Value Builder.
  3. Specify the data used in the Type and Value cell. Once you're done, click OK.