Software Testing
What is Quality Assurance(QA)? Process, Methods, Examples
Before we learn Quality Assurance, let's understand- What is Quality? Quality is extremely hard to define,...
Data Driven Testing is a software testing method in which test data is stored in table or spreadsheet format. Data driven testing allows testers to input a single test script that can execute tests for all test data from a table and expect the test output in the same table. It is also called table-driven testing or parameterized testing.
Data Driven Framework is an automation testing framework in which input values are read from data files and stored into variables in test scripts. It enables testers to build both positive and negative test cases into a single test. Input data in data driven framework can be stored in single or multiple data sources like .xls, .xml, .csv and databases.
In this tutorial, you will learn
Data Driven Testing is important because testers frequently have multiple data sets for a single test and creating individual tests for each data set can be time-consuming. Data driven testing helps keeping data separate from test scripts and the same test scripts can be executed for different combinations of input test data and test results can be generated efficiently.
Example:
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 dataset 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.
Consider you want to Test Login functionality of an application.
Step 1) Identify the Test Cases
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 |
| Username: valid password: valid | Login Success |
2 | Check Login for invalid credentials |
| Username: invalid password: valid | Login Fail |
3 | Check Login for invalid credentials |
| Username: valid password: invalid | Login Fail |
Step 3) Create Test Script
If you observe the Test Steps Remain common through the 3 Test Steps. You need to create a Test Script to execute these steps
// This is Pseudo Code // Test Step 1: Launch Application driver.get("URL of the Application"); // Test Step 2: Enter Username txtbox_username.sendKeys("valid"); // Test Step 3: Enter Password txtbox_password.sendKeys("invalid"); // Test Step 4: Check Results If (Next Screen) print success else Fail
Step 4) Create an excel/csv with the Input Test Data
Step 5) Step Modify the Scrip to Loop over Input Test Data. The input commands should also be parameterized
// This is Pseudo Code // Loop 3 Times for (i = 0; i & lt; = 3; i++) { // Read data from Excel and store into variables int input_1 = ReadExcel(i, 0); int input_2 = ReadExcel(i, 1); // Test Step 1: Launch Application driver.get("URL of the Application"); // 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(Next Screen) print success else Fail }
Above are just 3 test cases. The test script can be used to loop over following test cases just by appending test data values to Excel
And so on
Below given are Best testing practices for Data-Driven testing:
Data-Driven offer many advantages some of them are:
Some Drawbacks of Data Driven Automation Testing method are:
Before we learn Quality Assurance, let's understand- What is Quality? Quality is extremely hard to define,...
Before we pen down more details on the type of web testing, lets quickly define Web Testing. What is...
What is the Test Case? A TEST CASE is a set of actions executed to verify a particular feature or...
Dynamic Testing Dynamic Testing is a software testing method used to test the dynamic behaviour of...
1) Which protocols are supported by LoadRunner? As of LoadRunner 9.5 following protocols are...
Before we begin testing, let's quickly study the basic healthcare domain knowledge. HealthCare...