After hook not executing when scenario outline example fails
cucumber v1.3.14 ruby 1.9.3 @448
When a scenario outline example fails because of an RSpec::Expectations::ExpectationNotMetError, the after-hook is never executed. In scenario it works as expected.
Scenario Outline: Failing example
When 1 equals <number>
Then the example should pass
Example: |number|
|1 |
|2 |
When (/^(\d) equals (\d)$/) do |number1, number2|
number1.should == number2
end
After do |scenario|
if scenario.failed?
raise "Something went wrong and I want to add additional info, but it doesn't work"
end
end
Was this recently introduced?
Do we know if this fails in an earlier version of cucumber? I've suddenly been seeing instances were stuff did not take screenshots on failure (part of our after hook code), and am wondering if this is the cause.
Is the problem that it is not executing the after, or is the problem perhaps that scenario.failed is not true?
Hi Chuck,
The existing code in production has a whole load of issues like this (e.g. https://github.com/cucumber/cucumber/issues/560, https://github.com/cucumber/cucumber/issues/52) which is why we've embarked on a rewrite of the internals for version 2.0 (on master)
I'd assume this is working in that master branch, but I'd appreciate someone checking.
Please re-test with cucumber v 2.0.0.beta.1 and re-open if this is still a 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.