-
Notifications
You must be signed in to change notification settings - Fork 751
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to skip BeforeStep, AfterStep for selected steps bindings? #952
Comments
You can use scoping (http://specflow.org/documentation/Scoped-Bindings/) or get the name of the scenario from the ScenarioContext and handle this in your step code. |
I am not sure using scope is the correct way, when I am trying this:
this step is not recognize in feature file.
|
Sorry, I misread step with scenario. Scopes don't work here.
|
Thx for help :) What when I have 10 steps method, do I need to add 10 ifs in BeforeAfterHook method? Can I mark somehow these steps methods to do not use BeforeAfterHook step method? |
As far as I remember StepInfo.Text should be the text of the scenario in the feature file without the keyword at the beginning. |
Yeah. but this is not the best approach :( PS. I got nullReferenceException on ScenarioStepContext Edit: You missed Current :). ScenarioStepContext.Current.StepInfo.Text |
Sorry, we don't have anything else to achieve your requirements. It would need to extend Scoping for a step level. Feel free to submit an PR for that. |
Ah, the ScenarioStepContext is not in the DI container. Yeah, so you need to do ScenarioStepContext.Current. |
I solved the problem :)
|
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Hi,
I have a global method with [BeforeStep] and [AfterStep] attribute. It is calling before and after all steps definitions in my tests dll.
Is it possible to skip execute it before and after selected steps. Something like that:
The text was updated successfully, but these errors were encountered: