Data Driven Testing is a test automation framework that stores test data in a table or spreadsheet format. This allows automation engineers to have a single test script that can execute tests for all the test data in the table.
In this framework, input values are read from data files and are stored into a variable in test scripts. DDT (Data Driven testing) enables building both positive and negative test cases into a single test.
In Data-driven test automation framework, input data can be stored in single or multiple data sources like xls, XML, csv, and databases.
Why Data Driven Testing?
Frequently we have multiple data sets which we need to run the same tests on. To create an individual test for each data set is a lengthy and time-consuming process.
Data Driven Testing framework resolves this problem by keeping the data separate from Functional tests. The same test script can execute for different combinations of input test data and generate test results.
For example, we want to test the login system with multiple input fields with 1000 different data sets.
To test this, you can take following different approaches:
Approach 1. Create 1000 scripts one for each data-set and runs each test separately one by one.
Approach 2. Manually change the value in the test script and run it several times.
Approach 3. Import the data from the excel sheet. Fetch test data from excel rows one by one and execute the script.
In the given three scenarios first two are laborious and time-consuming. Therefore, it is ideal to follow the third approach. Thus, the third approach is nothing but a Data-Driven framework.
Best practices of Data Driven testing:
- Below given are Best testing practices for Data-Driven testing:
- Use Data to Drive Dynamic Assertions
- It is ideal to use realistic information during the data-driven testing process
- Test flow navigation should be coded inside the test script
- Drive virtual APIs with meaningful data
- Test positive as well as negative outcomes
- Re-purpose Data Driven Functional Tests for Security and Performance
Advantages of Data-Driven testing
- Allows to test application with multiple sets of data values during Regression testing
- Test data and verification data can be organized in just one file, and it is separate from the test case logic.
- Actions and Functions can be reused in different tests.
- Some tools generate test data automatically. This is useful when large volumes of random test data are necessary, which helps to save the time.
- Allows developers and testers to have clear separation for the logic of their test cases/scripts from the test data.
- The same test cases can be executed several times which helps to reduce test case and scripts.
- Any changes in the test script do not effect the test data.
Disadvantages of Data Driven testing
- Quality of the test is depended on the automation skills of the Implementing team
- Data validation is a time-consuming task when testing large amount of data.
- Maintenance is a big issue as large amount of coding needed for Data-Driven testing.
- High-level technical skills are required. A tester may have to learn an entirely new scripting language.
- A text editor like Notepad is required to create and maintain data files.