-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Adding Test Step in AfterStep feature file. #931
Conversation
…ucumber-ruby into add_step_to_afterstep * 'add_step_to_afterstep' of https://github.com/t-morgan/cucumber-ruby: Adding Test Step in AfterStep feature file.
Isn't not having If the intention is to add both
to:
And another change to.
|
I could be wrong, but it seems to me that since upgrading to Cucumber 2 the only argument I an receiving from the AfterStep hook is a Cucumber::Core::Test::Result of whatever status the step invocation was. |
Hm, based on #450 I thought that the AfterStep hooks in Cucumber v2 received a Cucumber::RunningTestCase, as the Before and After hooks do. |
It was definitely a scenario object in Cucumber 1.x when the issue was first reported (and it was pretty simple to get the step through that scenario at the time). In Cucumber 2.x, I am only finding a result in the AfterStep block (Before and After still receive the scenario as normal). I know I can add the test_step when the hook action is created in the after_step_hooks method of Cucumber::Runtime::StepHooks in lib/cucumber/runtime/step_hooks.rb and my test will pass... I'm just not sure if that is the right/best place to do it. |
…urrent AfterStep hook should work
…ed in an AfterStep as the second argument
I went ahead and implemented my change to fix the AfterStep hook functionality. If there are any changes that should be made, please let me know. I had to flatten an array in lib/cucumber/rb_support/rb_hook.rb because the argument passed into the AfterStep hook was being wrapped in an Array for some reason. |
Thanks sharing your fix @t-morgan. |
Could you rename the feature (and reword the description) to just be a general feature for AfterStep hooks? It should live here: https://github.com/cucumber/cucumber-ruby/tree/master/features/docs/writing_support_code |
Hey @mattwynne, I cleaned up the feature file and moved it as you requested. I think it might be a good idea to also include another scenario showing AfterSteps do run for background steps (apparently this was not always the case). |
@t-morgan What would be a "background step"? Some command running in the background? |
@maxmeyer, it is just a step defined under 'Background:' for the feature. |
Ah. Ok. :-) |
Are you about to merge this to master? We're planning to measure the time it takes a step to complete, and this modification would be extremely useful. |
Adding Test Step in AfterStep feature file. See cucumber#931
Please merge it, AfterStep is quite useless in its current form. |
Is there a nicer way to get the index of the step other than this? step.source[-2].children.index(step.source.last) |
Thanks @t-morgan! |
As part of our new policy I've invited you to become a committer to this repo @t-morgan. I liked how you found your way around the code and tested your change. I hope we'll get more contributions from you in future! |
applied the fix to my local 2.3.3 install, it works... thanks... |
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. |
Working on Add step to AfterStep #450
Do you think the argument list should be consistent with how formatters work or will it potentially cause problems moving the current argument out of its position as first argument?