Skip to main content

How to run common background steps before each scenario under the same business rule



  • Andreas Willich

    Background for Rules isn't supported in SpecFlow.

    The only workaround I can think about is to put tags on the Scenarios and use a tag scoped BeforeScenario hook to execute the common code.

  • Mandy Feeney

    Thanks for your response, Andreas. The Given steps are fairly important to the setup of all scenarios under a Rule so that people can easily see what is going on and would also impact the outcomes in the Then steps. So maybe in this case duplicating the steps is better.

  • Andreas Willich

    Or you organize every rule in their own feature file and use the normal feature background.


Please sign in to leave a comment.

Powered by Zendesk