I am new to SpecFlow and set up several test functions / scripts that are designed for authenticated users of different types of roles. I do this through browser automation with Coypu.
So, I have a background step in this function to configure user registration in this type of roles.
Background: Given I am logged in as a ...some role I'm interested in...
After each script in this function, I want to register the user again (otherwise, the step of entering the background mode will not work for the next scenario - I support the same instance of the Coypu browser open between tests).
I found the [AfterScenario]
annotation that I could use, but since it covers all the scripts in all the functions (as far as I understand ...), this will affect the scripts for unverified users.
I could cover [AfterScenario]
with [Scope(Feature="Some Feature")]
, I suppose, but I expect that you will need to enter / exit before and after a number of functions that I'm testing, and I'm not interested in indicating all this with a bunch of magic lines.
So, I am wondering if there is something that I can add to the Feature file, like the equivalent of Background, but run after each script in this function. (Or, alternatively, maybe the on / off method for each scenario is not the best way to do something?)
source share