Telerik blogs

Greetings, fellow testers. I recently attended a workshop on Acceptance Test Driven Development, during which the presenter spoke about distilling requirements down using examples. This is a great opportunity for testers and developers to work closely with Product Owners to determine exactly what output is expected from given inputs.

There are also times when the code behind a function is particularly obtuse or for some other reason testing is best done via the application itself.

Both of these are great opportunities for data-driven automation. Data-driven test automation lets us repeat a set of test steps automatically, using a set of pre-defined values both as input and to test the application's output. While a tester could be set down in front of the keyboard and mouse, they'd always be constrained by time and so we'd need to determine a realistic subset of values to use. It would be better to let a computer run through a large number of scenarios in a fraction of the time. We can do that using Test Studio's Data Driven Testing.

Using a spreadsheet, CSV file or database, we can define as long a list of scenarios as we'd like. In this example, we've created a spreadsheet of values to test a sales tax calculation, and the Business Analyst has verified that the formulas being used are correct. She was also able to make sure we included scenarios she felt may be of particular importance, adding to the whole organization's ownership of quality.

Sample spreadsheet of values for data-bound test automation.

Using Test Studio, it's a simple task to create a test for the page with one set of values, then bind that to the spreadsheet and let it run automatically. Test studio reads the data, fills in the input fields and checks the output against the expected values. In this particular scenario, we were able to check 150 different sets of values in just a few minutes.

Output from Data-Driven automated testing, showing both success and failures for various values.

We can quickly see where any problems are — in this case a developer was truncating a decimal value where they should have been rounding. Test studio allowed us to quickly determine the cause, get it resolved, and re-run the tests to everyone's satisfaction.

Telerik TV: Data-Driven Test Automation Using Test StudioFor a more in-depth look, see my video Data-Driven Test Automation Using Test Studio on Telerik TV, and the code for the demo app used is on github.

I'd be interested in hearing about other situations where data-driven testing has helped you, and invite you to drop me a note or comment below.


About the Author

Steven Vore

Steven Vore

Steven Vore is an Evangelist for Telerik's Test Studio. He has worked in software support and testing for the better part of two decades, and enjoys exploring ways to make software easier to use. He is a fan of movies and music, and can often be found on Twitter as @StevenJV.


Comments are disabled in preview mode.