Start your demo and save on the first 12 months!

Blog

Data-driven test automation.

Posted by on 21 January 2021 in Blog

What is data-driven testing?

 

Data-driven testing is a software testing methodology that uses tables of “data” directly as test inputs and expected outputs (e.g. inputs and outputs from a row in a table), as well as the process where test environment settings and control are not hard-coded.

 

 

Anything that can be subject to change (elements such as environment, test data, expected results, etc.) is separated out from the test logic (scripts) and moved into an external source: a configuration or test dataset.
The logic executed in the script is driven by the data values. In this way, scripts become just “driver” for the data.

 

In the software testing world, there are many possible approaches to implement this type of methodology.

Data-driven testing automation consists of the creation of a framework of automated test scripts and their related data sets.
Exploration of the application under test, reading of the data sources, and logging of test status and information can be all coded in the automated test scripts. In this way, the framework provides re-usable test logic to reduce maintenance and improve test coverage.
The data, inputs and expected results, can be stored in one or more data sources (files or DBMS), depending on the specific project and organization needs. In a mature automation environment, data can be even retrieved from a running system.
Having said so, it is probably not difficult to detect that the Data-driven test automation framework is a powerful automated regression testing tool.

 

What are the benefits of data-driven testing?

 

Data-driven testing introduces the ease to add additional inputs to the “table” when new partitions are discovered or added to the application under test.
At the same time, the cost aspect makes Data-driven testing very cheap for automation.

As a matter of fact, the main benefits of Data-driven testing are:
– reduced the cost of adding new tests and changing them when business rules change. This is done by creating parameters for different scenarios, using data sets that the same code can run against.
– easy identification of the data that are most important for tested behaviour. By separating first-class scenario data into parameters, it becomes clear what matters most to the test. This makes it easy to remember how something works when developers need to change it.

Data-driven testing separates test automation into two distinct activities: 1) Logic (script) Design and 2) Data Harvesting.

Logic Design is performed by testers whose expertise is on the domain knowledge and business logic side, who write scripts. For example, they can do it just following the correct syntax for keywords. In this way, They can not be involved in the implementation of the keywords, and will only need to focus on designing the right test cases using keywords. In parallel to test design, the keywords can be implemented (i.e. coded) by automation testers, using the scripting language of the testing tool they are using.

 

Data Harvesting does not require any technical know-how or skills and almost everyone can perform it. This favours the participation of all the members of the team in the test creation. Indeed, it is very easy to produce several test’s data sets, so several test’s scenarios, and even, theoretically generate test data automatically.

Data-driven testing also allows testing of the application with multiple sets of data values during regression testing and reusing of actions and functions in different tests
It results in the creation of extensive scripts that are flexible and easy to maintain as It does not let changes in test scripts affect the test data.

 

How can I create data-driven tests with Maveryx?

 

With Maveryx, testers can use the good old Excel to write data sources for automated tests, or CSV and XML files, or a DBMS.

Test scripts can be written in the form of Java Classes, Methods and Functions, or of keywords tables, using the TestDataManager class to handle the data sources or just writing the data source path in tables’ cells.
A very easy automated test script example in Java follows.

Conclusion

 

Data-driven testing is a software testing methodology that separates test logic from environment, process and test data.
The idea in Data-driven Testing is just to provide an approach that can be used to create automated test cases not depending, for as much as possible, on parameters and data outside test scripts’ logic, allowing easy and efficient reuse of the scripts and significantly reducing the test maintenance.
With Maveryx, users, regardless of their skill level, can build automated Data-driven tests for desktop or web applications in code or tabular format, and run them immediately as the application is available for testing.

 

External links

 

https://en.wikipedia.org/wiki/Data-driven_testing