Telerik blogs

Greetings, fellow testers. Last week we talked about Data Driven Tests and how they can speed through dozens or hundreds of variations quickly for you. In the example I used a simple sample application, just a web page with a form.

Often we need to log in and/or perform some setup steps before the actual "meat" of the test, or have some cleanup tasks after we're done — we certainly wouldn't want to do that for every iteration. That would be silly and time-wasting. Let's look at a better way.

Here's our simple test, modified to use a login screen.

All steps in one test

If you've watched my video on Data-Driven Test Automation Using Test Studio on Telerik TV, steps 6-10 should look familiar. Those are the important parts, where we fill in the values, initiate the calculation, and verify the result. Steps 1-5 are just for logging in and making sure we're on the right page. This test runs just fine, but we obviously don't want or need to execute the first 5 steps every time.

Let's split this into two tests.

steps separated into two tests, one called from the other

Here you can see that the login steps are in their own test, with no data binding. When we execute this test, it will log us in and make sure we're on the right page   and this will happen only one time. At the end, we've used the Add Test as Step commend to insert an Execute test test step. We've moved the later steps, those that we need to have run multiple times, into their own test and have it bound to the data.

Telerik TV: Data-Driven Test Automation Using Test Studio, RevisitedThis way our login is only done once and gets out of the way. The calculation-checking test then steps in and runs based on the data we've provided. You can see this in action over on TelerikTV: Data-Driven Test Automation Using Test Studio, Revisited.


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.