Getting started in Data-Driven testing with Katalon
What is Data-Driven testing?
Data-driven testing is a method to automate test case run with a different set of test data in each run as well validate the test result with the provided test data, this will greatly reduce time consumption compare to test it manually or when writing an automation test script due to not have to write different static test data in each test case, and will broaden the overall test case coverage at the same time based on the test data that has been set.
Several used case example of Data-Driven testing
- Login verification test purpose
- Calculation formula test purpose
- Profile data validation purpose
- Payment response test purpose
Other than that the used case will vary based on case needs, and it is not limited only to the examples above
How to start data-driven testing using Katalon
In this example, we try to automate a sign-in and verification process on a practice website at http://automationpractice.com/. We will be focusing on the Email address field, Password field, and Sign in button to do the sign-in process and username title to do verification when already signed in successfully
1. Create Test Case and add Object
Firstly we need to create a new Test Case i.e: User Login, and add some object locator either by record using Katalon’s own recorder or manually add an object locator using available object properties
2. Create a Local Variable
The next thing to do is we need to add a local variable in the User Login test case to bind with test data in the test suite later on
3. Add Steps in Test Case
After that, we create a step in the test case, for example in the following steps:
- Open a browser and navigate to the URL
- Set text on the email field
- Set text on the password field
- Click the login button
- Lastly, verify the text in the username title, in this example we use Katalon Verify Element or you can swap it with an assert statement.
Note that all the “Input” shall be mapped with the variable that we’ve been defined before.
4. Prepare the test data in excel doc
For the test data we have to fill the row with a column header, and also a set of credential that will be used in the data-driven sign-in and verification process
5. Attach Test Data in Katalon
After we have a test data, open our Katalon, create a new project and attach the test data to it, and the row data/record will be displayed in File’s Information
6. Create a Test Suite
When the test case is done, the next step is to create a new Test Suite to do a data binding and used it as a test case container
After done creating a new test suite, bind the variable in the test case with the test suite, set Data Iteration to “All” to run all the available records in test data.
7. Run the Test Suite
Finally, we run the test suite and it will do a complete run on the test case multiple times based on how many row/records that available in the test data as shown below
Conclusion
Testing a case with a huge amount of test-data, let’s say 1.000 records of data to verify the expected result would take quite some time when test it manually, there is also a possibility of a human error in it, by using a data-driven method it will reduce those obstacles and minimize the effort when the test data is increasing over time, due to we will no longer need to modify the script much or even at all.
By using the Katalon framework to start creating data-driven testing, it is fairly straightforward hence already familiar with the concept, from there the complexity will vary to the case requirement and your approach on how to automate a case using the data-driven method.
The shown above concept itself will be able to translate quite the same when using other tools/frameworks example such as TestProject, Cypress, or Selenium in respective IDE, except that it might require to write more code and importing necessary framework or library when using Selenium for example.
Thanks for reading and Best of Luck!