-
Notifications
You must be signed in to change notification settings - Fork 252
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
ScenarioContext.AfterStep not invoked after a failed case #370
Comments
@stroem, thanks for the issue! How would you prefer this, always execute the hooks, even on skipped steps or not execute them? BR Fredrik |
I think it is safer to have them execute always, using the test status if desired to act differently depending on success, failure or being skipped. |
@fgm, Thanks for your feedback! |
Haven't look in detail, but I think the info is already present on the PickleStep passed to the hook, is it not ? |
@fgm I don't think so, we only pass the parsed Step information as of now. I propose doing like this, change so that we execute the AfterStep as well and keep the BeforeStep as is, so we make it consistent and then have another discussion on how we can indicate that a specific step won't be executed or if we should skip the hooks completely. The discussion (#360) about adding context to the step execution might also be a good topic to take up this issue in a future solution. |
* Add new contextualized API for hooks and steps * Make default context configurable * Run AfterStep hooks even after failed steps, fixes #370 * Update CHANGELOG and README * Add step result status to After hook, fixes #378 * Elaborate hooks documentation * Add test to pass state between contextualized steps * Update README with example of passing state between steps
What version of godog are you using?
Godog version is: v0.11.0
What version of Go are you using?
go version go1.15.1 darwin/amd64
What did you do?
I enabled the hooks BeforeStep and AfterStep on godog.ScenarioContext to output som logs after each step, and it worked just fine, until one step failed. After the step failed the BeforeStep was invoked but not the AfterStep.
What did you expect to see?
Either both the AfterStep and BeforeStep is invoked on following steps after a failed step or both AfterStep and BeforeStep is not invoked after a failed step.
What did you see instead?
BeforeStep was invoked for every step after a failed step, but not the AfterStep.
The text was updated successfully, but these errors were encountered: