cucumber-ruby: Cucumber does not go to AfterStep if the step is failed!

Summary

Originally raised in https://github.com/cucumber/cucumber/issues/26#issuecomment-247807756 by @hangnguyenthuy

I’m using Cucumber 2.3.3 I want to print some log after each step so I have my code like this:

AfterStep do
  print_log_for_step(@current_step)
end

But in case the step is failed, it never goes to AfterStep, it move to After scenario so I cannot print log of the failed step. Right now I have to work around in this case.

Anybody has same problem to me?

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Reactions: 3
  • Comments: 25 (9 by maintainers)

Most upvoted comments

@sandhusatnam try replacing puts with Kernel.puts.

I think the bug here is that Cucumber’s own puts doesn’t print what’s printed in AfterStep, not that the hook doesn’t run.