I've started using SpecFlow and wondering it wold be possible to reuse scenarios between specs
Basically my idea is this (i might be fundamentally wrong :) )
I have one feature written to validate the navigations.
Feature: Navigation
I should be able to navigate to all the pages i'm authorized to
Scenario: Navigate to Boo
Given I enter proper values in Foo
When I enter Go
Then I should be taken to Boo**
And then I have another spec that would validate the operational side of the Boo
Feature: Validate if Boo is working ok
So in here i basically need to navigate to the Boo screen first. I was thinking if I can reuse the Scenario: Navigate to Boo scenario written in Navigation
Is this possible? Else, what is the best way to go around it?
/BB
You have two options here:
Create a class which has shared steps, common to many scenarios. In your case, this class would contain the step "When I navigate to Boo". This then would be available to other features.
You can have to more then one step with the exact same name/text, but you can use a ScopedStepBinding to make sure the correct version of that step is called for a feature. So you could have "When I navigate to Boo" appearing in more then one feature file, but by using a step scoping, you can control which code is run for a feature file.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With