Data Binding to run test case from external files in Katalon
Katalon Studio provides the ability to execute automation tests with external data sources like excel files, csv files. This can be achieved by first importing the external files and then Data binding of this data with the test cases.
In this article we will discuss about topics which are used to achieve Data Binding:
Import Test Data from External Excel/ CSV file in Katalon Studio
- Data is maintained in external files that can be Excel or CSV.
- First these files need to be imported in the Katalon project to use them in the Data Binding.
You can refer to the full steps here .
Create a New Test Suite in Katalon Studio
- Test suite is a collection of Test Cases that are arranged logically. Test cases that are grouped together can be different or duplicate.
For complete steps to create a Test suite refer here.
- Open a Test Suite, select Add button .
- All test cases in Katalon Studio will be displayed in the Test Case Browser dialog.
Below is an example for same:
Test Case that we are using for Demo:
String testcaseName = TestCaseName; System.out.println(testcaseName); System.out.println("Travelling from: "+departure+" Tracvelling to: "+destination+" passenger name: "+Name +" with Address: "+Address);
Manage Data Binding of Test suite in Katalon Studio
- In the test suite editor, click Show Data Binding to expand the Data Binding section with the Test Data and Variable Binding tables.
2. In the Test Data table, select Add > select the data to be used for execution from Test Data Browser Dialog box > the selected test data are added to the list accordingly
3.In the Data Binding table which displays all variables of the selected test case, select all rows > choose Set Type > select Data Column as their types.
4. Click Set Test Data to decide which test data from the list to be used for execution.
5. Click each cell in the Value column to specify the data field in the selected data file.
The final variable binding will display as below:
6. After finishing all the steps above, save and run your test suite to see the following result:
Test case is executed with different set of external data that is binded to the test case.
Map All button: can quickly map the public variables of the selected test case with respective columns in the test data. To automatically bind the variable to the data, the variables and the respective columns in Test Data should share the same name.