• Software Testing Dictionary
  • Home

Software Data Driven Testing



Data-driven testing is creation of test scripts where test data and/or output values are read from data files instead of using the same hard-coded values each time the test runs. This way, testers can test how the application handles various inputs effectively. It can be any of the below data files.

  • Datapools
  • Excel Files
  • ADO Objects
  • CSV Files
  • ODBC Sources

What is Software Data Driven Testing?

A data driven testing is the one in which the test cases are segregated from the data set. Also, it gives the provision to run the same test case against multiple sets of data. Since the test code implementation and test data are independent of each other, the data set can be modified without impacting the implementation logic and vice-versa.

Advantages of a Data Driven Testing

Data driven testing allows optimal use of test cases by ensuring a more structured execution. This also helps to shorten the test cycle while ensuring a quality product. The test implementation code comprising various functions, methods, and actions are tested with a wide range of data sets in a data driven testing approach thereby improving the test coverage. Thus the various functions, methods, and actions used in the code can be reused multiple times.

In future, in case the application behavior changes, the modifications are made in the implementation code and the test data which is maintained in a separate file need not be touched. Similarly, if a change in test data needs to be done or a new set of test data needs to be created, updates are made only in the external file storing the data without impacting any part of the implementation logic developed in the code.

The test data is not implanted in the code for data driven testing. Now-a-days, mostly the test data generation is carried out by different tools and it becomes available by exporting the data generated in the files having the formats like excel, csv, xml, txt, and so on. Thus a huge chunk of data is generated within a short span of time and it does not require much maintenance effort.

One more advantage of the data driven testing is that, to test both positive, negative, and edge flows for a requirement, three different test cases need not be developed. However, a single test case which is fed with different sets of data (positive, negative, and edge) maintained in the external files. Thus it helps to get rid of redundant test cases.

Disadvantages of a Data Driven Testing

In order to create data driven testing which completely separates out the data and implementation layer, it requires high technical skills. The team working on writing data driven testing needs to have knowledge of scripting languages, and other third party tools like Apache POI, and so on.

This is essential in creating an integration system between two entities - data and logic. So it is seen that in order to adopt data driven testing in projects, there is a huge dependency of automation testers who can both fix the technical issues and test the product or the application.

As a project scales up, the test cases and data required to test the product or the application under test also become huge. In such cases, it is seen that the external files may crash or become unresponsive or it takes a lot of time to complete the full cycle of testing (increases the execution overhead) consisting of a big chunk of data.

Practical Example a Data Driven Testing

Let us take an example of an application which deals in selling cars online. Let us see some positive, negative and edge cases −

  • User enters name, email, phone number, correct amount for car price, then clicks on buy. Successful buy should happen.
  • User enters the name, email, phone number, negative amount for car price, then clicks on buy. Error should be thrown saying invalid amount.
  • User enters the name, email, phone number, amount less than car price, then clicks on buy. Error should be thrown saying a lesser amount.
  • User enters a name, email, phone number, no amount for car price, then clicks on buy. Error should be thrown saying invalid amount.
  • User keeps the name blank, then enters the email, phone number, correct amount for car price, then clicks on buy. Error should be thrown saying invalid user.

Why is Data Driven Testing Used?

In data driven testing, more than one set of data can be run against the same test case, thus the same application can be tested against a wide data range without requiring additional code. Thus code is developed once but reused multiple times.

A data driven testing framework allows multiple execution of test cases without increasing the number of test cases. Sometimes, test data is generated automatically and this allows the application to be tested against a wide range of random data sets. In such a scenario, data driven testing ensures a more robust and quality product.

Different Data Driven Testing Methodologies

The difference data driven testing methodologies are listed below −

Data in Excel

In this type of data driven testing, multiple sets of test data is maintained in the excel workbook.

Keyword in Excel

The data driven testing which is driven by the keywords is used here. The keywords stand for the actions that are to be performed on the application under test. This is done primarily to segregate the coding implementation from the actual data. In future, if there is a change in the data, then the code needs to be touched and vice versa.

Data in XML

In this type of data driven testing, multiple sets of test data is maintained in the XML files.

Conclusion

This concludes our comprehensive take on the tutorial on Software Data Driven Testing. We’ve started with describing what is software data driven testing, advantages of data driven testing, disadvantages of data driven testing, practical example a data driven testing, why is data driven testing used, and different data driven testing methodologies.

This equips you with in-depth knowledge of Software Data Driven Testing. It is wise to keep practicing what you’ve learned and exploring others relevant to Software Testing to deepen your understanding and expand your horizons.

Advertisements