Skip to main content

Data-driven testing at test case level

  • An active Katalon Studio Enterprise (KSE) license. To learn more about activating your license, you can refer to this document: Activate Katalon license.

Data-driven testing (DDT) at test case level allows you to add data files and manage data binding at test case level. It helps you keep the data binding in the test case independent, regardless of the test suites it is added to.

This article demonstrates how to:
  • Perform data binding at test case level
  • Execute that test case in a test suite
  • View data-driven test reports

Bind data at the test case level

Before you perform data binding at the test case level, you need to prepare test data files and test case variables.

Create a test data file

To create a test data file, go to File > New > Test Data. Katalon Studio allows you to use external or internal data sources for test execution. To learn more about creating new data files, refer to: Manage Test Data.

Create test case variables

  1. Go to File > New > Test Case to create a new test case.
  2. Go to the Script view and input the following script:
    println "${employee} - ${department}"
  3. Switch to the Variables tab. Click Add, then input variables in the newly added row.
    The variables tab

Perform data binding

To perform data binding at the test case level, do as follows:
  1. Navigate to the Data Binding tab. You can see the Test Data and Variable Binding tables.
  2. In the Test Data table, click Add.
    Add data files

  3. Select the data files to use for variable binding in the Test Data Browser dialog, then click OK.
    Test Data Browser

    The selected test data files appear in the Test Data table.

    Results after adding data files

    • If you add multiple data files, by default, Katalon defines the relationship of multiple data sources at the test case level as one-to-one relationship. To learn more about the relationship between multiple data files, see Manage test data relationship.
  4. In the Variable Binding table, do as follows:
    1. Highlight both data rows, click Set Type > Data Column.
      Set Data Type

    2. In the Test Data column, click on each row to choose the data files.
      Choose Test data for Data Type

    3. In the Value column, click on ... to specify the data field in the selected data file.
      Choose Value for Data Type

      If the variables and selected data files column headers share the same name, you can click Map All to quickly map them together.

  5. Save and run the test case. You can view the execution results in the Log Viewer.
    Results in Log Viewer

Execute test suite containing test case level data binding

You can execute a test case with configured data binding regardless of the test suite data binding.
  1. Add the test case with configured data binding to a test suite.
  2. In the test suite editor, click Show Data Binding.
    Data binding section in the test suite

  3. Click on the test case, then select the Use Variables and Binding at Test Case option.
    With this option:
    • Katalon Studio will execute the test case with the test case level data binding.
    • When enabled, you can not conduct data binding at the suite test case.
    • If your test suite has existing data configurations, switching to the Use Variables and Binding at Test Case option does not remove the pre-configured data in the suite test case.
  4. To edit the test case level data binding, click on the Test Case hyperlink.
    You are navigated to the Data Binding tab of the test case.
  5. Once finished, click Run to execute your test suite.
You've executed a test suite with a test case using data binding at test case level.

View test reports

After the test suite execution, to view your test reports, do as follows:
Go to the Reports folder in the Test Explorer panel.

  • When running a test suite that uses data binding 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.