Data-driven testing with Katalon Studio
Data-driven testing (DDT) is a software testing method that stores test data in table or spreadsheet format. Data-driven testing allows testers to input a single test script that can execute tests for all test data from a table and expect the test output in the same table.
Katalon Studio allows you to perform data-driven testing with internal and external data sources at both test case and test suite levels. You can download the data-driven testing sample project from our GitHub repository: Shopping cart sample.
This document discusses the DDT components and the supported data-driven testing methods in Katalon Studio.
Variables
Katalon Studio supports three types of variables: Global variables, Test Case variables, and Groovy variables.
Global variables are variables defined in the execution profile and can be used in a test case, test object, web service object, and email configuration within a project. To learn more about global variables, see Global variables.
Test case variables are variables defined in a test case, allowing you to pass dynamic data into a test case. You can create test case variables and call test cases with variables in both manual and script mode.
To learn more about using test case variables, see Test case variables.
Katalon Studio supports Groovy from version 2.4.x onwards.
// x is defined as a variable of String type
String x = "Hello";
// y is defined as a variable of int type
int y = 5;
// The value of the variables are printed to the console
println(x);
println(y);
To learn more about Groovy, refer to this Apache Groovy document: Groovy semantics.
Test data
Test data is the data created for data-driven testing.
You can create internal or external data files, then configure data binding to read test data values from these files. To learn more about test data in Katalon Studio, see Manage test data.
By default, Katalon Studio converts variables to strings to perform data binding. However, you can disable this function to allow Katalon Studio to read test data values as their data types. See: Enhanced variable binding.
Set parameter for your test script
You can pass variables to your test scripts by setting parameters in test cases, test objects, or their properties:
- Parameterize Web Test Objects
- Parameterize Mobile Test Object
- Parameterize Web Service Object
- Parameterize Windows Test Objects
Data-driven testing methods
In a test case: From version 8.3.0, you can perform data-driven testing in a test case independently from the test suite. See Data-driven testing at the test case level.
In a test suite: You can perform data-driven testing in a test suite. See Data-driven testing in a test suite.
In a dynamic test suite: Katalon Studio supports data-driven testing in a dynamic test suite. See Data-driven testing in a dynamic test suite.
Alternatively, you can also perform data-driven testing with Groovy using the findTestData
method. To learn about this method, you can refer to our API documentation: TestData.
Learn in practice with our free Katalon Academy course: Katalon Studio: How to Apply Data-Driven Testing.