Driven Testing

What is Data Driven Testing? Learn to create Framework

The testing procedure known as “Data Driven Testing” is a type of software testing in which the test data is kept in a table or spreadsheet format. Testers are able to participate in data-driven testing, which enables them to input a single test script that can execute tests for all test data taken from a table and anticipate the test output taking place in the same table. Testing in this manner can also be referred to as parameterized testing or table-driven testing.

Data Driven Framework

The Data Driven Framework is an automation testing framework that stores input values into variables in test scripts by reading values from data files. These data files contain the test data. Testers are afforded the opportunity to incorporate both positive and negative test cases into a single evaluation. The input data for a data-driven framework can be saved in a single data source or multiple data sources, such as databases,.xls files,.xml files, and.csv files.

Why Data Driven Testing?

Testing that is driven by data can have drawbacks, but why use data-driven testing in the first place?
The fact that testers frequently have multiple data sets for a single test and that developing individual tests for each data set can be a time-consuming process highlights the significance of data-driven testing. The use of data-driven testing makes it easier to keep data and test scripts separate. Additionally, the same test scripts can be executed for various different combinations of input test data, which allows for more efficient generation of test results.


As an illustration, we intend to test the sign-in system with multiple input fields using one thousand distinct data sets.

You can put this hypothesis to the test using one of the following methods:

Method 1: Write one script for each dataset in a total of one thousand scripts, and then run each test individually, one by one.

Approach 2: Make the necessary adjustments to the value in the test script by hand, then run the test multiple times.

Approach number three involves importing the information from the Excel sheet. Execute the script while retrieving test data from each row of Excel one at a time.

In the three possible outcomes, the first two involve a lot of work and take up a lot of time. Therefore, the third strategy should be followed as it offers the most benefits.

Consequently, the third strategy consists of nothing more than a data-driven framework.

How to create a Data Driven Automation Framework

Imagine that you want to test the functionality of the login section of an application.

1) Determine which test cases will be used.

Input Login was successful due to a valid username and password.
Failure to login due to the correct password being used with an incorrect username
Failure to login due to the correct username but an incorrect password being entered.

Step 2) Create detailed est Steps for above 3 Test Cases

Test Case# Description Test Steps Test Data Expected Results
1 Check Login for valid credentials
  1. Launch the application
  2. Enter Username password
  3. Click Okay
  4. Check Results
Username: valid password: valid Login Success
2 Check Login for invalid credentials
  1. Launch the application
  2. Enter Username password
  3. Click Okay
  4. Check Results
Username: invalid password: valid Login Fail
3 Check Login for invalid credentials
  1. Launch the application
  2. Enter Username password
  3. Click Okay
  4. Check Results
Username: valid password: invalid Login Fail

Step 3) Create Test Script

If you keep in mind that the Test Steps remain consistent throughout all three of the Test Steps. In order to carry out these steps, you will need to develop a Test Script.

/ Consider this to be Pseudo Code

/ Start the Application as the First Test Step

driver.get(“URL of the Application”); driver.get();

/ Test Step 2: Enter Username

txtbox username.sendKeys(“valid”);

/ Test Step 3: Enter Password

txtbox password.sendKeys(“invalid”);

/ Test Step 4: Check Results

If the print job on the next screen is successful, else it will fail.

Creating an Excel or CSV file with the Input Test Data is the fourth step.

Step 5) Modify the Scrip in order to iterate over the input test data. Additionally, parameterization of the input commands is required.

/ Consider this to be Pseudo Code

/ Loop 3 Times

for I = 0; I & lt; = 3; i++) {

/ Read information from Excel and save it in the appropriate variables.

int input 1 = ReadExcel(i, 0);

int input 2 = ReadExcel(i, 1);

/ Start the Application as the First Test Step

driver.get(“URL of the Application”); driver.get();

/ Test Step 2: Enter Username

txtbox username.sendKeys(input 1);

/ Test Step 3: Enter Password

txtbox password.sendKeys(input 2);

/ Test Step 4: Check Results

If the print job was successful (next screen)

else Fail


Above are just 3 test cases. Simply by appending test data values to Excel and using the test script’s looping functionality, subsequent test cases can be tested.

Due to incorrect user name and password input, the login attempt has failed.

Failure to provide a valid username and password will result in a failed login attempt.

Failure to log in due to entering an empty username and password.

On and so forth

Best practices of Data Driven testing:

Data-driven testing, with its recommended procedures:

The following is a list of best practises for testing in relation to data-driven testing:

During the process of data-driven testing, it is preferable to use information that is as realistic as possible.

It is recommended that the test script include coding for test flow navigation.

Power virtual application programming interfaces with meaningful data

Make your assertions more dynamic by using data.

Perform both positive and negative tests on the results.

Repurpose data-driven functional tests in order to improve performance and security.

The benefits of using data to drive testing

Data-driven offers a wide variety of benefits, some of which are as follows:

Advantages of Data-Driven testing

During regression testing, it enables testing of the application with multiple data sets and value combinations.

It is possible to organise both the test data and the verification data in a single file, and this file is kept separate from the test case logic.

It is possible to store all of the test scripts in a single repository if you use the appropriate tool. Because of this, the texts are much simpler to comprehend, maintain, and manage.

It is possible to repurpose actions and functions across a variety of tests.

There are some tools that can automatically generate test data. This is helpful in situations where large volumes of random test data are required, as it helps save time and is therefore useful.

Testing that is data-driven can be performed at any stage of the development process. The various steps involved in a data-driven test are typically combined into a single process. Nevertheless, it is applicable to a number of different test scenarios.

Gives programmers and quality assurance testers the ability to keep the logic of their test cases and scripts completely separate from the test data.

It is possible to execute the same test cases multiple times, which helps reduce the number of test cases and scripts.

Any modifications made to the test script will have no impact on the results of the test.

Disadvantages of Data Driven testing:

The following is a list of some of the disadvantages of the Data Driven Automation Testing method:

Disadvantages of Data Driven testing:

The level of automation expertise possessed by the Implementing team is directly proportional to the quality of the test.

When testing a large amount of data, data validation is an activity that takes up a lot of time.

Maintenance is a significant challenge because data-driven testing requires a significant amount of coding.

Technical expertise of a very high level is required. It’s possible that a tester will need to become fluent in an entirely new scripting language.

There will be additional documentation made available. The majority of this pertains to the management of scripts, test infrastructure, and test results.

In order to create and maintain data files, you will need to use a text editor such as Notepad.


A test automation framework known as “data-driven” stores test data in a format similar to that of a table or spread spreadsheet.

The input data for a Data-driven test automation framework can be stored in a single data source or multiple data sources, such as databases, XLS files, CSV files, and csv files.

The process of developing an individual test for every data set is one that is both lengthy and time-consuming. This problem is solved by the Data Driven Testing framework, which partitions the data from the functional testing environment.

When conducting data-driven testing, using information that is as close to real life as possible is the best possible option.

During the process of regression testing, it makes it possible to test the application using multiple data sets.

This approach has the disadvantage of being dependent on the automation skills of the team that is doing the implementing.