Quantcast
Channel: Active questions tagged selenium - Stack Overflow
Viewing all articles
Browse latest Browse all 98773

How to keep test scenarios short and independent?

$
0
0

I am building a test suite using BDD, and I know it's bad if your test cases depend on each other, but in some situations I can't see any other way to do it, for example:

Say I have 3 scenarios: one is signing up for a site, second is checking email for verification email and clicking it, and third is making sure I can log in with that newly created account. I have these as 3 different scenarios but if these 3 don't run in sequential order, it won't work, meaning they are dependent on eachother. because there is no verification email if you don't sign up first, and you can't sign in if you don't sign up and verify first. I could of course just make this into one big scenario, but I have also heard its bad practice to have long tests with multiple assertions.

So what should someone do in a situation like this? I can't see any way how these kinds of tests could ever be short and independent?

The only thing I have thought of is making a "Background" section that literally creates a random new account for every single scenario, but if I have hundreds of scenarios in total in my test suite I can't see how it would be good to simultaneously create hundreds of accounts every time we run tests in parallel (which I'm assuming is a big part of why we make tests short and independent).


Viewing all articles
Browse latest Browse all 98773

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>