Katalon Studio supports data-driven testing which helps users define data sets and execute test scripts much faster and easier in comparison with that in other frameworks.
This tutorial will give you an example of how to create an automation test case and execute it several times with different sets of data.
What You’ll Need
Katalon Studio: available for free at www.katalon.com
Before You Dive In
● If you execute Web UI testing, no additional settings are necessary.
● In terms of Mobile testing, you have to install Appium and enable USB Debugging mode on your device at first. Please refer to our Mobile Setup for Windows or for macOS.
● After launching Katalon Studio, input your registered username and password to activate this automation tool. The username and password are those used to login to https://www.katalon.com/. If you are not ready, check out Quick Start to get used with Katalon Studio.
The Data-Driven Testing Sample Project
The example of Data-driven testing is presented through a testing booking service. The booking form has 5 different fields, each field includes various options. The data used for a specific case may not lead to any error to the application, but for the other sets of data, it probably does. In order to make sure the application will be working probably regardless of the inputs, you may leverage data-driven testing for this scenario to execute the test automatically many times using different data tests.
Assume that we have to create a sample test case with the scenario is as below:
● Open the login page of the Katalon demo AUT website (http://demoaut.katalon.com/profile.php#login)
● Login using three different accounts
● Validate whether the login is a success
● Close the browser
You can use the below steps to automate the above test case.
Prepare the Data
Create a data file in Katalon including three login accounts. Refer to Manage Test Data for more details on how to create test data from different sources. The following example shows the internal data file with three accounts for http://demoaut.katalon.com (note that only ‘John Doe’ is valid):
Create a new test case using Web Record function
1. Create a new test case and generate the steps required to run data-driven testing. You can utilize the Web Record function to quickly create your test case:
● Access http://demoaut.katalon.com/profile.php#login (the Katalon demo AUT website)
● Enter username/password
● Click Login
● Validate if the Appointment page is displayed
The created test case should be the same as the following:
As can be seen, the input values for username and password are hard-coded as what you typed during the recording process (in this case it’s “admin”/”abc123”). In order to run this script various times using different accounts, you have to parameterize these values.
2. Switch to the Variables tab of the test case and generate two variables named ‘demo_usn’ and ‘demo_pwd’. Passwords in the default values as follows:
3. Switch back to the Manual view of the test case and set those two variables as inputs for the username/password fields.
Data-driven Tests Execution
Data-driven can be implemented by two methods, either using Test Suites or Test Cases.
Execution from test suites
1. Next, generate a test suite to execute the test case using the defined dataset.
2. Add the data file to the Test Data section and proceed to bind the two variables ‘demo_usr’ and ‘demo_pwd’ to the respective columns of the data file.
For more details variable binding, let’s refer to Data for test execution
3. You can now execute your test case. It will run three times using the accounts defined in the test data file.
Congratulations! You now complete all steps of how to approach Data-driven testing with Katalon Studio.
An expert on R&D, Online Training and Publishing. He is M.Tech. (Honours) and is a part of the STG team since inception.