DATA DRIVEN TESTING
APPROACH WITH
KATALON STUDIO
1.What is Data-driven testing?
• The Advantages of Data-driven testing
2.Data-driven testing approach with Katalon Studio
• Create a new test case using Web Record function
• Modifying the Data-Driven Test and Assigning Input
• Data-driven Tests Execution
WHAT IS DATA-DRIVEN TESTING?
Data-driven testing (DDT) is a common term in the computer software testing area. Its define a
testing has been done using a table of conditions directly as test inputs and verifiable outputs.
Also, in the data-driven testing process, the test environment settings and control are not hard-
coded.
This testing process is quite popular and normally applied right after the record and playback
mode. In other words, once a set of testing object under a test case is captured, testers will
need to add more input values from the external data files to ensure the application can handle
the most number of scenarios in the future.
WHAT IS DATA-DRIVEN TESTING?
In the control methodology, the external information is “read” from a database that can be any
of the below data files:
• Datapools
• Excel files
• ADO objects
• CSV files
• ODBC sources
The Advantages of Data-driven testing:
•The scripts could generate parallelly whilst developers are building the
application/software. The whole process of designing, planning and running the
database is independent towards the application development.
•The tester can avoid the irrelevant and unneeded duplication of testing scripts
generated since we already carry a standard file using for testing inputs and
verifying the data.
•All the outcomes from inputs, outputs to feasible testing results are collected and
stored under a well-managed text records.
The Advantages of Data-driven testing:
•Test cases will be handled under numerous set of data since it is the external
information collected separately to the test case. The information is stored under
external material which stems from Excel files, XML or any other texting sources.
•The test data can’t be impacted if the test scripts are changing since data-driven
testing is running separately with the development. The tester will have no
influence towards developers even though they make multiple changes.
•It is a good news for tester if errors or bugs generated in future will be minimized
to the lowest probability since there are multiple scenarios and inputs tested using
data-driven framework approach.
DATA-DRIVEN TESTING APPROACH WITH
KATALON STUDIO
Katalon Studio supports data-driven testing which allows users to define data sets and execute test
scripts faster and easier compared to data-driven testing in other frameworks.
This tutorial will provide you a simple example of how to create an automation test case and
execute it multiple times using different sets of data.
DATA-DRIVEN TESTING APPROACH WITH
KATALON STUDIO
Given a sample test case whose 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 if the login is success
• Close the browser
You can use the following steps to automate the above test scenario.
CREATE A NEW TEST CASE USING WEB RECORD FUNCTION
1. Create a new test case and proceed to generate the steps to:
• 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
You can utilize the Web Record function to quickly generate test steps. Refer to this
guide for more details on the Record & Playback feature of Katalon Studio.
CREATE A NEW TEST CASE USING WEB RECORD FUNCTION
Step 1: Click on the New Test
Case button on the main toolbar.
Provide a name for your test case and
click OK. An empty test case will be
created.
Step 2: Click on Record from the main
toolbar.
Step 3: Click on the Record button
from The Record dialog to start
recording test case.
Step 4: Follow the scenario above.
CREATE A NEW TEST CASE USING WEB RECORD FUNCTION
2. The generated test case should be similar to the following:
You can see that the input values
for username and password are
hard-coded as what you typed
during recording (in this case it’s
admin/abc123). In order to run
this script multiple times using
different accounts, you need to
parameterize these values. Please
continue to the next step.
MODIFYING THE DATA-DRIVEN TEST AND ASSIGNING INPUT
VALUES
3. Switch to the Variables tab of the test case and create two variables named ‘demo_usn’ and
‘demo_pwd’.
Step 1: Switch to Variables
tab of your Test Case. Then
click Add.
Step 2: A new row is added
to the variable list. Create
two variables named
‘demo_usn’ and
‘demo_pwd’. and save the
test case when you’re done.
MODIFYING THE DATA-DRIVEN TEST AND ASSIGNING INPUT
VALUES
4. Switch back to the Manual view of the test case and set those two variables as inputs for
the username/password fields.
Now that you have
done the necessary
steps to parameterize
the required fields for
login, proceed to the
next steps to prepare
data for execution.
MODIFYING THE DATA-DRIVEN TEST AND ASSIGNING INPUT
VALUES
5. Create a data file in Katalon to have a dataset containing three login accounts. You can
generate data file from sources such as Excel, CSV, Database etc… 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 login accounts
for http://demoaut.katalon.com (note that only ‘John Doe’ is valid):
MODIFYING THE DATA-DRIVEN TEST AND ASSIGNING INPUT
VALUES
5. Create a data file in Katalon to have a dataset containing three login accounts. You can
generate data file from sources such as Excel, CSV, Database etc… 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 login accounts
for http://demoaut.katalon.com (note that only ‘John Doe’ is valid):
DATA-DRIVEN TESTS EXECUTION
From here you can apply Data-driven using two methods:
• Test Suites
• or Test Cases.
DATA-DRIVEN TESTS EXECUTION
A. Execution from test suites
6. Next, create a test suite to
execute the test case using
the defined dataset.
DATA-DRIVEN TESTS EXECUTION
A. Execution from test suites
7. Expand the Data Binding
section, add the created 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. You
may refer to Data for test
execution for more details
about variable binding.
DATA-DRIVEN TESTS EXECUTION
A. Execution from test suites
8. Finally, you can run the test suite, and your login test case will be executed three times
using the accounts defined in the test data file.
DATA-DRIVEN TESTS EXECUTION
B. Execute from a test case
6. We can also implement Data-driven tests in a test case. Just create a new test case and
switch to Script Mode. To iterate tests with multiple sets of data, we need to use FOR
statement and call the test data objects. Copy and paste below code:
DATA-DRIVEN TESTS EXECUTION
B. Execute from a test case
1111. import com.kms.katalon.core.testdata.InternalData
InternalData data = findTestData("Demo_Account")
for (def index : (0..data.getRowNumbers() - 1)) {
WebUI.openBrowser('')
WebUI.navigateToUrl('http://demoaut.katalon.com/profile.php')
WebUI.setText(findTestObject('Page_Login/txt_UserName'), data.internallyGetValue("demo_usn", index))
WebUI.setText(findTestObject('Page_Login/txt_Password'), data.internallyGetValue("demo_pwd", index))
WebUI.click(findTestObject('Page_Login/btn_Login'))
WebUI.verifyElementPresent(findTestObject('Page_CuraHomepage/btn_MakeAppointment'), 0)
WebUI.closeBrowser()
}
DATA-DRIVEN TESTS EXECUTION
B. Execute from a test case
Where:
• Import InternalData class from Katalon built-in library and define data variable to locate test data table
• For statement to loop through all row of test data table which indicates how many times the test case will run
• To get a row value in test data table, use getRowNumbers() method syntax. For example:
Username field: data.internallyGetValue(“demo_usn”, index)
Password field: data.internallyGetValue(“demo_pwd”, index)
DATA-DRIVEN TESTS EXECUTION
B. Execute from a test case
7. When you have done in
Scripts view, switch back to
Manual view, the test case will
be showed as the following
screenshot:
8. Finally, you can run the test
case, and your login test case
will be executed three times
using the accounts defined in
the test data file.
Congratulations!
You now understand how to approach Data-driven testing
with Katalon Studio.
Tutorial video by Shiva Raj
https://www.youtube.com/watch?v=O95RSICQjus
Source: Data driven testing approach with Katalon Studio

Data driven testing

  • 1.
    DATA DRIVEN TESTING APPROACHWITH KATALON STUDIO
  • 2.
    1.What is Data-driventesting? • The Advantages of Data-driven testing 2.Data-driven testing approach with Katalon Studio • Create a new test case using Web Record function • Modifying the Data-Driven Test and Assigning Input • Data-driven Tests Execution
  • 3.
    WHAT IS DATA-DRIVENTESTING? Data-driven testing (DDT) is a common term in the computer software testing area. Its define a testing has been done using a table of conditions directly as test inputs and verifiable outputs. Also, in the data-driven testing process, the test environment settings and control are not hard- coded. This testing process is quite popular and normally applied right after the record and playback mode. In other words, once a set of testing object under a test case is captured, testers will need to add more input values from the external data files to ensure the application can handle the most number of scenarios in the future.
  • 4.
    WHAT IS DATA-DRIVENTESTING? In the control methodology, the external information is “read” from a database that can be any of the below data files: • Datapools • Excel files • ADO objects • CSV files • ODBC sources
  • 5.
    The Advantages ofData-driven testing: •The scripts could generate parallelly whilst developers are building the application/software. The whole process of designing, planning and running the database is independent towards the application development. •The tester can avoid the irrelevant and unneeded duplication of testing scripts generated since we already carry a standard file using for testing inputs and verifying the data. •All the outcomes from inputs, outputs to feasible testing results are collected and stored under a well-managed text records.
  • 6.
    The Advantages ofData-driven testing: •Test cases will be handled under numerous set of data since it is the external information collected separately to the test case. The information is stored under external material which stems from Excel files, XML or any other texting sources. •The test data can’t be impacted if the test scripts are changing since data-driven testing is running separately with the development. The tester will have no influence towards developers even though they make multiple changes. •It is a good news for tester if errors or bugs generated in future will be minimized to the lowest probability since there are multiple scenarios and inputs tested using data-driven framework approach.
  • 7.
    DATA-DRIVEN TESTING APPROACHWITH KATALON STUDIO Katalon Studio supports data-driven testing which allows users to define data sets and execute test scripts faster and easier compared to data-driven testing in other frameworks. This tutorial will provide you a simple example of how to create an automation test case and execute it multiple times using different sets of data.
  • 8.
    DATA-DRIVEN TESTING APPROACHWITH KATALON STUDIO Given a sample test case whose 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 if the login is success • Close the browser You can use the following steps to automate the above test scenario.
  • 9.
    CREATE A NEWTEST CASE USING WEB RECORD FUNCTION 1. Create a new test case and proceed to generate the steps to: • 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 You can utilize the Web Record function to quickly generate test steps. Refer to this guide for more details on the Record & Playback feature of Katalon Studio.
  • 10.
    CREATE A NEWTEST CASE USING WEB RECORD FUNCTION Step 1: Click on the New Test Case button on the main toolbar. Provide a name for your test case and click OK. An empty test case will be created. Step 2: Click on Record from the main toolbar. Step 3: Click on the Record button from The Record dialog to start recording test case. Step 4: Follow the scenario above.
  • 11.
    CREATE A NEWTEST CASE USING WEB RECORD FUNCTION 2. The generated test case should be similar to the following: You can see that the input values for username and password are hard-coded as what you typed during recording (in this case it’s admin/abc123). In order to run this script multiple times using different accounts, you need to parameterize these values. Please continue to the next step.
  • 12.
    MODIFYING THE DATA-DRIVENTEST AND ASSIGNING INPUT VALUES 3. Switch to the Variables tab of the test case and create two variables named ‘demo_usn’ and ‘demo_pwd’. Step 1: Switch to Variables tab of your Test Case. Then click Add. Step 2: A new row is added to the variable list. Create two variables named ‘demo_usn’ and ‘demo_pwd’. and save the test case when you’re done.
  • 13.
    MODIFYING THE DATA-DRIVENTEST AND ASSIGNING INPUT VALUES 4. Switch back to the Manual view of the test case and set those two variables as inputs for the username/password fields. Now that you have done the necessary steps to parameterize the required fields for login, proceed to the next steps to prepare data for execution.
  • 14.
    MODIFYING THE DATA-DRIVENTEST AND ASSIGNING INPUT VALUES 5. Create a data file in Katalon to have a dataset containing three login accounts. You can generate data file from sources such as Excel, CSV, Database etc… 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 login accounts for http://demoaut.katalon.com (note that only ‘John Doe’ is valid):
  • 15.
    MODIFYING THE DATA-DRIVENTEST AND ASSIGNING INPUT VALUES 5. Create a data file in Katalon to have a dataset containing three login accounts. You can generate data file from sources such as Excel, CSV, Database etc… 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 login accounts for http://demoaut.katalon.com (note that only ‘John Doe’ is valid):
  • 16.
    DATA-DRIVEN TESTS EXECUTION Fromhere you can apply Data-driven using two methods: • Test Suites • or Test Cases.
  • 17.
    DATA-DRIVEN TESTS EXECUTION A.Execution from test suites 6. Next, create a test suite to execute the test case using the defined dataset.
  • 18.
    DATA-DRIVEN TESTS EXECUTION A.Execution from test suites 7. Expand the Data Binding section, add the created 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. You may refer to Data for test execution for more details about variable binding.
  • 19.
    DATA-DRIVEN TESTS EXECUTION A.Execution from test suites 8. Finally, you can run the test suite, and your login test case will be executed three times using the accounts defined in the test data file.
  • 20.
    DATA-DRIVEN TESTS EXECUTION B.Execute from a test case 6. We can also implement Data-driven tests in a test case. Just create a new test case and switch to Script Mode. To iterate tests with multiple sets of data, we need to use FOR statement and call the test data objects. Copy and paste below code:
  • 21.
    DATA-DRIVEN TESTS EXECUTION B.Execute from a test case 1111. import com.kms.katalon.core.testdata.InternalData InternalData data = findTestData("Demo_Account") for (def index : (0..data.getRowNumbers() - 1)) { WebUI.openBrowser('') WebUI.navigateToUrl('http://demoaut.katalon.com/profile.php') WebUI.setText(findTestObject('Page_Login/txt_UserName'), data.internallyGetValue("demo_usn", index)) WebUI.setText(findTestObject('Page_Login/txt_Password'), data.internallyGetValue("demo_pwd", index)) WebUI.click(findTestObject('Page_Login/btn_Login')) WebUI.verifyElementPresent(findTestObject('Page_CuraHomepage/btn_MakeAppointment'), 0) WebUI.closeBrowser() }
  • 22.
    DATA-DRIVEN TESTS EXECUTION B.Execute from a test case Where: • Import InternalData class from Katalon built-in library and define data variable to locate test data table • For statement to loop through all row of test data table which indicates how many times the test case will run • To get a row value in test data table, use getRowNumbers() method syntax. For example: Username field: data.internallyGetValue(“demo_usn”, index) Password field: data.internallyGetValue(“demo_pwd”, index)
  • 23.
    DATA-DRIVEN TESTS EXECUTION B.Execute from a test case 7. When you have done in Scripts view, switch back to Manual view, the test case will be showed as the following screenshot: 8. Finally, you can run the test case, and your login test case will be executed three times using the accounts defined in the test data file.
  • 24.
    Congratulations! You now understandhow to approach Data-driven testing with Katalon Studio.
  • 25.
    Tutorial video byShiva Raj https://www.youtube.com/watch?v=O95RSICQjus
  • 26.
    Source: Data driventesting approach with Katalon Studio