I am wanting to run common steps before each scenario under the same business rule (Using the Rule keyword in gherkin). How can I organise my feature files to run common steps at the Rule level?
I tried using a Background below each of my Rules but this doesn't seem to work as I was hoping, as it seems like only 1 Background will be ran per feature file and SpecFlow seems to just pick the first one in the file to run - so if you had more than 1 Background underneath different Rules, all the other ones will be ignored / not ran. The below is the structure of my gherkin I had tried to write:
Rule: Some business rule we want to cover
Given I want to do some common task for this rule
Scenario: First scenario of rule 1
Scenario: Second scenario of rule 1
Rule: Another business rule
Given I want to do some other common task for this rule
Scenario: First scenario of rule 2
Scenario: Second scenario of rule 2
Is there a way of currently achieving this using SpecFlow or is this simply not currently being supported for rules?
Please sign in to leave a comment.