This is a migrated thread and some comments may be shown as answers.

Single Or Separate Tests For Expected Success/Failure Scenarios?

1 Answer 8 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Top achievements
Rank 1
Steve asked on 21 Aug 2017, 05:27 PM

This is a test-authoring question about how to organize tests. I have a dozen examples of places where I want to go through a data-creation process (users, forms, etc.) but I want to test and validate 3 things:

- Successful creation

- Failed creation (expecting certain blocks/failures)

- Random data input (conditionally reacting to success or failures)

Should I be creating different tests for every single kind of scenario, so that each test has only one particular purpose, or is it good practice to have a single test that has IF/ELSE blocks to handle successes and failures based on data-driven input? My programming instincts are telling me to stick with single-purpose cohesive tests, nesting them with "Test As Step" when needed, but my ease-of-use side is making me think it's a reasonable solution to have fairly conditional tests rather than creating a vast number of tests handling every unique situation.

...or maybe it's a hybrid case-by-case thing that I have to evaluate based on the application's testing needs?

Any advice is welcome!


1 Answer, 1 is accepted

Sort by
Telerik team
answered on 22 Aug 2017, 11:20 AM
Hi Steve,

Thank you for reaching us out. 

In general the decision how to handle that situation should be yours to reflect what is more suitable for you in the terms of maintenance of the project. 

As per the details you have shared I would suggest you could have few tests as step to separate the different scenarios. For example: 
Login to the application test
Fulfillment/Creation of the user, form, etc. 
Expected success
Expected failure
Random result 

Then reusing these tests you could create few parent tests to cover the scenarios. Or use a single parent test and handle these with if..else. 

Basically there is no wrong or right approach to accomplish that. It is important to build the project in a way to be user friendly to yourself and your colleagues. 

I hope that information will be useful to you. Though in case of further queries please do not hesitate to contact me again! Thanks for your understanding in advance! 

Elena Tsvetkova
Progress Telerik
The New Release of Telerik Test Studio Is Here! Download, install,
and send us your feedback!
General Discussions
Asked by
Top achievements
Rank 1
Answers by
Telerik team
Share this question