Tuesday February 12, 2019
Data Driven Testing is an Automation framework where we can iteratively run multiple data set from an external source like a table for the same test scriptinstead of hard coding.
Multiple data setsand test environment can be controlled and run without hard coding and results obtained can be compared.
If data is hard coded it is highly tedious, monotonous and inefficient to run the same test script for different data set.
This becomes easier when data from different sources can be fed as input, this input gets verified and result outputs obtained can be compared.
Why should we go for Data Driven Testing?
In real life applications with frequent changes in data set such as addition, modification and deletion of data, hard coding data makes it difficult or almost impossible to run each time.
Data Driven Testing makes it much easier to use and maintain voluminous data individually in tables.
Manually to cover all the scenarios, a tester may have to design multiple test scripts or edit existing test scripts multiple times and run it individually.
Thus, making this difficult or almost impossible task. For a Manual Tester, it is humongous and monotonous.
That’s exactly when Data Driven Testing comes to the rescue. Test Data can be fed from a table or other sources, independently without making changes to the test script.
All these data run for the same test script iteratively and results obtained can be compared.
Test data are stored in an easily maintainable manner like tables or rows and columns and then passed as input variables to the AUT.
Test scripts and Data Provider are two separate entities having no direct impact on each other. Verified results from each test execution are then compared from expected results of the Data Provider.
Data can be fed in different forms. Few popular ones are
Data Driven Script
Scripts containing hard-coded data can be tough to maintain and sometimes they can break the execution.
In Data Driven Testing Test scripts and Test Data are separated and made into separate entities.
Hence Data Provider is independent of test script and both can be modified individually without impacting each other.
Real Life Citation
We shall take anexample of online registration form. Data from Registration forms increase frequently sometimes every day. Each User registration add data rows in database.
1.Let’s take a simple form with Name, Email, Password and Confirm Password
2. Test Scenarios are identified and test cases are designed.
3. For now, consider only happy path – validating that data in table and actual result are correct.
4. Now let’s feed multiple data from a spreadsheet, csv file or the like as a table as below
5. During Test execution test script is run and data is taken from the table.Each data is executed one after the other in iteration row after row.
6. Once script is executed, actual results and expected results are compared.
7. Notice that data has been modified – added newly at the end of the table, edited existing in the middle row and deleted in-between the table. This can be easily done by modifying the Data table like below without touching the script.
This can be easily done by modifying the Data table like below without touching the script.
8. Data has been modified easily without changing the script.
Automation framework for Data Driven Testing
This method can be used integrating with various Test Automation Tools like Selenium, QTP, TestComplete, TestNG etc
Advantages of Data Driven Testing
Disadvantages of Data Driven Testing
To sum it up,
Data Driven Testing a very good strategy if we have huge volumes of data to be tested for same scripts provided there is a highly skilled testing team. And it does not suit projects that do not have much work with data.