Skip to end of metadata
Go to start of metadata

Data-driven testing (DDT) is a test design approach where the test data (input and output values) are separated from the actual test case. DDT enables the repetition of the same sequence of test steps with the help of a data source in order to drive the input values of those steps and the expected values while verification steps are performed. Commonly, test cases are designed using variables in the test step level. A variable placeholder is added in the test step to receive the values from the data source instead of using hard-coded or fixed values. By doing so, each time the test case is executed, the variable is replaced with the test data existing in the data source. For each row in the test data table a new set of steps will be unfolded during the test execution (with the variable replaced with the test data) as displayed in the diagram below:



Data-driven testing in action

Depending on the business rules you have to validate during the test case design, you may need to repeat the test case several times with different test data to ensure that the application works as expected for various input values. For example, if you have to design test cases to test the search and book a flight functionality of an airline company, you'll need to check different combinations of input values for the search screen (i.e. from, to, depart, return, class, etc). To prevent duplication, along with the test case you can provide a data source with test data to map each combination you need to address to leverage the coverage, as seen in the image below:

When designing test cases using the DDT approach, the focus should be in mapping the test data and its different combinations and variations (negative and positive) to meet the requirements and business rules and ensure adequate test coverage. By doing so, during the test execution, the variable placeholders in the test step level are replaced by the values available in the test data table, ensuring complete reusability of the steps instead of using hard-coded or fixed values as displayed in the image below:

When designing test cases using the DDT approach, the focus should be on mapping the test data and the different combinations and variations (negative and positive) to properly meet the business requirements and ensure adequate test coverage. By doing so, when executing test cases using Test Management for Jira, the variable placeholders in test steps are replaced by the values available in the test-data table, ensuring complete reusability of the test steps.

DDT can be used with manual test scenarios, enabling manual test scripts to run together alongside their respective data sets. In DDT, the following operations are performed in a loop for each row of test data in the data source:

  • Test data is retrieved

  • Test data is input into the system under test (SUT) and simulates other actions

  • Expected values are verified

  • Test execution continues with the next set of test data

Benefits of data-driven testing

Adopting DDT is a way of ensuring repeatability and reusability of existing test cases. DDT leverages test coverage by feeding different types of test data – either valid or invalid (positive and negative test cases). As a result, you can benefit from a dramatic reduction of redundant test cases and bugs in production. Other benefits of adopting DDT include:

  • Increased test coverage
  • Reduction in time spent designing and maintaining test cases
  • Repeatability and reusability of existing test cases
  • Reduction in the number of test cases


Notes

You cannot enable both Test Data and Parameters at the same time.

Procedure

1. Open the desired Test Case and then click on Test Script.

2. On the dropdown, click on Test Data.

3. In the Test Data section define a name for the new column and click Add Column to add columns.


4. Now start adding the values for the test data. Use Add new row when you want to add a new value. For each value added when the test is executed the test steps will be unfolded with a different value.

5. Once you have the required columns defined you can start to add them to the test steps. To do this, as you type, use a curly bracket { and a list of the columns for the test case will display. Select the one you want and it will be added to the test script.

6. When the Test Case is ready to be executed in the Test Player the test steps are repeated so that every variation of the test data is executed to ensure complete coverage.

Using Datasets

Datasets allow you to define standardized test data parameters that can be re-used in test cases across the Project on the test scripts. Datasets ensure consistency across test cases and prevent data duplication. 

Procedure

1. Create datasets with the desired set of reusable data.

2. When creating data columns, select and add the desired dataset to ensure consistency in the data input.

3. When populating the test data table, select the desired values from the datasets to prevent data duplication and ensure consistency.

  • No labels