Updating the name of SpecFlow scenario outline variations
gherkin, naming, scenarios, specflow
Solution
As the SpecFlow Scenario Outlines documentation says:
the Gherkin syntax does not enforce that all example columns have the matching placeholder in the scenario outline, you can even introduce an arbitrary column in the example sets for better test method name readability
So you could introduce an arbitrary column into your "Examples" table to succinctly describe the intention of the test e.g.
Scenario Outline: Example
Given I am a user
When I enter <x> as an amount
Then the result should be <result>
Examples:
| example description | x | result |
| Example Description 1 | 3 | 3 |
| Example Description 2 | 1 | 1 |
This would result in the following test names:
Example_ExampleDescription1
Example_ExampleDescription2
Problem
I have this feature file: ``` Scenario Outline: Example Given I am a user When I enter <x> as an amount Then the result should be <result> Examples: | x | result | | 3 | 3 | | 1 | 1 | ``` My issue is that after it's run, each example is labeled as `variant #` Is there a way to name what each example line is actually testing, so that in the report, we know better what is tested, not just: ``` Scenario: Example, Variant 0 Scenario: Example, Variant 1 Scenario: Example, Variant 2 ``` I'm trying to help our testers get more meaningful reports; there is typically a reason they write multiple examples, and they want that reason for that example shown somehow.