Do you think IIT Guwahati certified course can help you in your career?
No
Introduction
Hey Ninjas!! Welcome to another article on Katalon. The Katalon platform offers testing solutions. It benefits teams of various sizes and testing maturity levels. The toolkit assists small teams in the early stages of automation. It helps to grow into large international corporations in AI/ML. It also supports sharing of API documents to collaborate with external teams. Katalon also supports API Testing. The API testing tool tests a software on performance and reliability.
The blog explains the details of Combining Multiple Data Sources and testing at the test case level in Katalon.
Without further ado, let's get started.
Expanding the Data Binding Section
First, we need to expand our Data Binding section. The data binding allows us to wrap up similar data types together. We can do this by going to our test suite, where we can find a feature named Show Data Binding. This assists you in managing variable binding with the test suite you want to run. Test suites in katalon are a collection of test cases. It also binds the specified test data files. Variable binding allows users to wrap up similar types of variables together. Follow the steps:
Click theShow Data Binding option.
In this section, we can find two tables- Test Data and Variable Binding.
The Test Data table contains the specification of the test files used for test execution.
The Variable Binding table contains all variables of the test case.
Credit: docs.katalon.com
Let us individually learn them in detail.
Test Data table
It contains the specification of the test files used for test execution.
For adding data sources, the Add option is used to add data file(s).
Click the Add button.
The Test Data Browser dialog box will appear as shown below.
Credit: docs.katalon.com
Here, we can select whichever combination of data files we want to use for variable binding.
Select OK.
The Test Data table containing all the test data files will appear.
Credit: docs.katalon.com
Here all the data files and folders are displayed.
The Test Data table will look like the following:
Credit: docs.katalon.com
Double-click on the Data Iteration column. The Data Iteration column has 3 options:
Run all rows: To execute the test using all of the data rows in the data file.
Run from row .. to row ..: To use the data range in the data file from one specific row to another specific row during the test execution.
Run with specific rows: To execute tests using particular data rows from the data file. The rows can be defined using commas and hyphen characters.
The Data Iteration column looks like the following:
Credit: docs.katalon.com
You can iterate through the rows using the above Dialog Box.
Variable Binding table
Variable Binding table contains all variables of the test case. All the test case's variables are automatically imported into the Variable Binding table.
Follow the following steps:
If all the variables have the same type, you can Set Type for them all at once.
Let us consider Password and Username are of the same type as a data column in this instance.
Select Set Type > Data Column while selecting both rows.
Credit: docs.katalon.com
Click on each row. This will select the test data files for execution.
Credit: docs.katalon.com
Click on each row in the Value column to choose the data field in the chosen data file.
Credit: docs.katalon.com
Save the corresponding test suite.
Credit: docs.katalon.com
The results will be saved as shown above.
Bind to scripting value
You can utilize an option known as Bind to scripting value. This will associate the variables with other scripting values. The scripting value refers to the data present in a specific column name.
For instance, we want to highlight row no. 1 and row no. 2.
Follow the steps:
Click on the option Set Type.
Select Script Variable.
Credit: docs.katalon.com
You can specify which data to be used in the Value cell as shown below.
Credit: docs.katalon.com
This will bind your variable to the scripting value.
Data-driven Testing at the test case level in Katalon
Data-driven testing is a technique for testing software. With data-driven testing, testers can enter a test script that can run tests using all test data from a database. They can anticipate the test results to be returned in the same table.
You can add one or more data files and handle data binding using data-driven testing (DDT) at the test case level. It helps you maintain the binding data's independence in the test case.
Using this feature, you can perform the following:
Bind each test case to a specific set of information.
Open a test case and run it using various test data combinations.
You have the option of performing new data binding in a test suite or reusing data binding at the test case level when running a test suite with linked test cases.
This feature enables you to perform data-driven testing in a dynamic test suite in addition to the data-driven testing techniques we presently support.
Performing Data Binding at the Test case level
Follow the following steps to perform data binding:
Creating a new test data
Select File > New > Test Data to create a new data file.
Create test case variables
The following steps creates new test case variable:
Go to File, click on New and then select Test Case. Give a specific name to the test case, and a new test case will be created. In the below image, we have named the new test case as DDT at TC level.
Credit: docs.katalon.com
Go to the Variables tab and click on Add to add test case variables.
Credit: docs.katalon.com
Select the Data Binding tab. Here, two tables are present: Test Data table, and Variable Binding table.
Credit: docs.katalon.com
The above image displays the Test Data table and Variable Binding table.
In step 2, we have added new test case variables in the Variables tab.
Credit: docs.katalon.com
The variables added in this step will get automatically added in the Variable Binding section.
Perform Data Binding
The following steps perform data binding at the test case level:
Navigate to the Test Data table and perform following steps:
First step is to add data files. Click on Add. The Test Data Browser dialog box will appear.
Credit: docs.katalon.com
The Test Data Browser window allows you to choose which data files to utilise for variable binding.
Press OK.
In the Test Data table, the chosen test data files are displayed.
Credit: docs.katalon.com
Double-click on the cell in each data file's Data Iteration column to specify the data range.
Go to the Variable Binding table and perform the following steps:
If all of the variables are of the same type, you can Set Type for all of the variables at once. Consider the following example:
Here, the Employee and Department variables are having same type as the Data Column. When both rows are selected, select Set Type and then select Data Column. The data type will be set at once.
Credit: docs.katalon.com
Go to the Test Data column.
Select the test data files for execution by clicking on each row as shown below.
Credit: docs.katalon.com
When a variable and a data field in a selected data file have the same name, select Map All. It will rapidly map all variables to all data fields.
Credit: docs.katalon.com
Here, this method automatically maps the test data's "Employee" and "Department" columns to the "Employee" and "Department" variables.
You can also click on each row to select the data field in the chosen data file in the Value column.
Credit: docs.katalon.com
Save the test case and execute it.
Navigate to the Log Viewer tab to see the test results
Credit: docs.katalon.com
The log viewer will display the result as shown above.
Execute/Run test suites with connected test cases
The following steps run test suites with associated test cases:
Add the associated test case with a test suite.
Click on the Show Data Binding option in the test suite editor for performing data binding.
Credit: docs.katalon.com
Choose the level of data binding. At the suite test case (STC) or the test case (TC), you can bind data. By default, the Use Variables and Binding at Suite Test Case option is chosen.
Credit: docs.katalon.com
Click on the Run button to execute the test suite.
Frequently Asked Questions
What exactly is meant by data files in Katalon?
Data files are a powerful feature that enables us to easily store and retrieve data from sources.
What is meant by data-driven testing(DDT)?
Data-driven testing (DDT) is data that is loaded and utilized to extend the automated test cases that are not part of the functional tests.
Does Katalon use WebDriver?
Katalon uses the Selenium WebDriver framework.
Conclusion
In this article, we have extensively discussed the details of Combining Multiple Data Sources and testing at the test case level in Katalon Studio.