Is is possible to share a common set of examples across multiple scenario outlines in Specflow without duplicating the set of examples for each outline?
e.g. excuse the noddy example, but here the Examples
are repeated for each Scenario Outline
and I want to know if it's possible to declare those Examples
once and use them for each Scenario Outline
?
Feature: Just an example about animals
Scenario Outline:
Given an <animal>
When something happens
Then this should be the outcome
Examples:
| animal |
| Dog |
| Cat |
Scenario Outline:
Given an <animal>
When something different happens
Then this other thing should be the outcome
Examples:
| animal |
| Dog |
| Cat |
Each scenario outline can have multiple tables with examples. The parameters in scenario outlines allow test runners to paste the examples from the table into the outline.
Feature files can have more than one Scenario or Scenario Outline. You can write all your possible requirements or Scenarios for a particular feature in a Feature File. One Scenario is separated from another using the "Scenario" or "Scenario Outline" keyword.
@Nir Multiple scenarios can be added by just specifying a new Scenario: tag. Scenario outline is detailed in the SpecFlow docs on their site. Without really understanding what it is you want to parameterise, I can't offer a code sample.
If you have data valid for the whole feature, place it in the feature context. But this data can't be modified in one scenario and accessed in another. The tests will be executed in an order determined by your test runner. Different runners may choose different orders.
It appears this is not actually possible in SpecFlow.
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