top of page
Search

Data-Driven Testing Framework

Updated: Jul 29

As mentioned in Selenium Testing Framework before, I will introduce the first commonly used framework in Selenium Testing - Data-Driven Testing Framework.


What is Data-Driven Testing?


Data-Driven is a test automation framework that stores test data in a table, spreadsheet format like Excel file, CSV, XML. JSON or some database table. This allows automation engineers to have the capability to execute tests for all the test data in the table with just a single test script.


In this kind of framework. the input values are read from data files and stored into a variable in test scripts. Multiple values are attached to each variable, so a load of test cases can be executed with just one script.


Why Data-Driven Testing?


We frequently have multiple data sets that need to be run on the same test, and to create an individual test for each data is an extremely monotonous and time-consuming job. This also causes the maintenance struggling, while there are changes in one test script, we have to do the same massive effort on the other scripts to match with others.


Data-Driven Testing Framework

Example:

Testers want to test the login functionality with multiple input data sets (500 data sets). The tester may have 3 following approaches:

  1. Create 500 test scripts one for each data set and run each test script one by one.

  2. Modify the test data manually in the test script and run it several times.

  3. Import data from other sources (ex: Excel sheet). Fetch test data from excel rows one by one and execute the test script.

In the three given scenarios, the first two seem laborious and time-consuming. Therefore, it is recommended to follow the third approach.

And it is a Data-Driven Framework.


Create a Data-Driven Automation Framework


In the example below, you will know about the concept of how to implementing a simple data-driven framework with a practical case.


Consider we want to test the login functionality of automatedtestingwithtuyen.com.


Login of automatedtestingwithtuyen.com

For simple, we only take 2 output results for the test: login success and login failure.


Step 1: Identify test cases


Step 2: Create detailed steps

Step 3: Create the test script

Step 4: Create an Excel/CSV file with the input test data of email and password

Step 5: Modify the script with parameterized input from Excel/CSV file

In case we add more test value rows in Excel/CSV data file, the test script can be used to loop over following the created test cases.


We will have another post about using Apache POI library, which working with reading data from Excel file, to create a data-driven testing framework with Excel/CSV.


Advantages of Data-Driven Testing Framework


Data-Driven Testing Framework offers some advantages:

  1. Test application with multiple sets of data with just the same script during regression testing.

  2. When large numbers of random test data are necessary, this framework saves a lot of time by running data sets which are generated automatically by some tools.

  3. The same test cases can be executed several times which helps to reduce test case and scripts

  4. Any changes in the test script do not affect the test data.


Disadvantages of Data-driven Testing Framework


Some drawbacks that we can face:

  1. Quality of the test depends on automation skills of implementing team members.

  2. Data validation is time-consuming when testing a large number of test cases.


Conclusion

  1. Data-Driven is a test automation framework that stores test data in a table/spread spreadsheet format/database or any documented file.

  2. In Data-Driven framework, input data can be stored in single or multiple data sources like XLS, XML, CSV, and databases.

  3. To create an individual test for each data set is a lengthy and time-consuming process.

  4. Data-Driven Testing Framework resolves this issue by keeping the data separate from test script logic.

  5. It allows testing application with multiple sets of data values during Regression testing

  6. Drawback of this method is that it is depended on automation skills.

190 views0 comments

コメント


bottom of page