c# SpecFlow, how to get an Example row index in a scenario from ScenarioContext (or other test context)

300 Views Asked by At

In c# SpecFlow, in the method AfterScenario for example, I can get the Scenario Title as ScenarioContext.Current.ScenarioInfo.Title

If the Scenario contains many Examples (in the sense of Gherkin feature file) and I would like to get the Example context, let us say its index in the list of Examples. How can I find it? Do I have to set it at the start of the test? If yes, how and where?

Here is an example of a Gherkin Scenario:

Scenario Outline: a scenario
 Given The user '<UserName>' 
 When He opens the 
 Then The he should 

Examples:
 | UserName |
 | user1    |
 | user2    |

Thank you!

0

There are 0 best solutions below