Data-driven testing (DDT) at the test case level allows you to add one or more data files and manage data binding at the test case level. It helps you keep the binding data in the test case independent, regardless of which test suites it is added to.
This function allows you to:
- Bind each test case to a fixed set of data.
- Run a test case with different test data combinations.
- When executing a test suite containing associated test cases, you can either reuse data binding at the test case level or conduct new data binding in a test suite.
Besides our currently supported data-driven testing methods, this feature also allows you to conduct data-driven testing in a dynamic test suite. To learn more about data-driven testing with dynamic test suites, you can refer to this document: Data-driven testing in a dynamic test suite.
Katalon Studio version 8.3.0 onwards.
An active Katalon Studio Enterprise license. To learn more about activating your license, you can refer to this document: Activate Katalon license.
This article demonstrates how to manage data binding at the test case level and execute them in a test suite.
Conduct data binding at the test case level
Create a new test data
To create a new data file, go to File > New > Test Data. Katalon allows you to use external or internal data sources for test execution. To learn more about creating new data files, you can refer to this document: Manage Test Data.
Create test case variables
Create a new test case. Go to File > New > Test Case. Here, we name the test case DDT at TC level.
In the new test case, switch to the Variables tab. To add test case variables, click Add. Input variables in the newly added row.
- Navigate to the Data Binding tab. You can see there are two tables:
Test Data: Specify here the data files for your test execution.
Variable Binding: This displays all variables input in the Variables tab.
Values input in the Variables tab from step 2 will automatically populate in the Variable Binding section.
Conduct data binding
What is an iteration?
An iteration is a test case executed with a test data row.
To conduct data binding at the test case level, do as follows:
In the Test Data table:
Click Add to add one or more data files. A Test Data Browser dialog opens.
Select the 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.
- If you are adding a combination of data files, by default, Katalon defines the relationship of multiple data sources at the test case level as One-to-One relationship. You can learn more about the relationship between multiple data files here: Manage test data relationship.
To specify the data range, double-click on the cell under the Data Iteration column of each data file. You can learn more about types of data iterations here: Modify data range.
In the Variable Binding table:
Katalon Studio allows users to Set Type for variables all at once if the variables have the same type.
In the following example, the Employee and Department variables 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.
If the variables and the data field in the selected data files share the same name, you can quickly map all the variables with the data fields in the data file by clicking Map All. For example, with this function, the 'Employee' and the 'Department' variables automatically map with the 'Employee' and 'Department' columns of the test data.
Alternatively, you can also click on each row to specify the data field in the selected data file in the Value column.
Save the test case and run it. To view your test results, go to the Log Viewer tab.
Execute test suites containing associated test cases
What is a suite test case?
A suite test case is a test case in a test suite.
To execute test suites in the CLI, Docker, or CI/CD tools, you need an active Katalon Runtime Engine license.
For real-time monitoring and better reporting capabilities, consider integrating your project with Katalon TestOps. Learn more about Katalon TestOps integration here: Upload Test Results to Katalon TestOps from Katalon Studio.
- Add the associated test case to a test suite.
To conduct data binding, in the test suite editor, click Show Data Binding.
Select the data binding level. You can bind data at the test case (TC) or suite test case (STC) level. The Use Variables and Binding at Suite Test Case option is selected by default.
Options Description Use Variables and Binding at Test Case With this option:
Katalon executes the associated test case with the data binding at the test case level.
To edit the data binding at the test case level, click the Test Case hyperlink. By doing so, the users are navigated to the Variables & Data Binding tab of the associated test case.
While selecting the Use Variables and Binding at Test Case option, you can not conduct data binding at the suite test case level.
Use Variables and Binding at Suite Test Case With this option:
Katalon executes the associated test case with the data binding at the suite test case level.
You can edit the Test Data and Variable Binding tables at the STC level. To learn more about binding data at the STC level, you can refer to this document: Manage Data Binding.
- In case your test suite has existing data configurations, switching to the Use Variables and Binding at Test Case option does not remove the preconfigured data in the suite test case.
Once finished, hit Run to execute your test suite.
When running a test suite that uses variables and bindings at the test case level, the total number of executed test cases in test reports is the number of executed iterations. In the above example, we run a test case with 3 different sets of data, we can see the results of three executed test cases in the test reports.
Alternatively, you can also view your reports and details in
<your-project-folder>/Reports. Katalon Studio supports exporting test reports into different formats, such as HTML, CSV, PDF, and JUnit. You can learn more about exporting reports here: Generate reports.