Get all steps in BefroeScenario
AnsweredIs there a way to get all the scenario steps on [BeforeScenario]? The only way I found to get a step from ScenarioContext is when the actual step is being executed.
-
Official comment
There is no API available for that, but we add the feature files since I think 3.5 as resources into the assembly.
With a `assembly.GetManifestResourceNames().Where(r => r.EndsWith(".feature"))` you should get all feature files. You can then look for the right feature file and parse it on your own with the Gherkin parser. Then you can search for the right scenario.
So not the easiest way for doing it.
I created a feature request for creating a nice API at: https://support.specflow.org/hc/en-us/community/posts/360014628717--SpecFlow-Be-able-to-access-a-list-of-all-steps-via-API
Please vote on it, if you want to see this implemented.
Please sign in to leave a comment.
Comments
1 comment