Details
Description
We noticed that methods annotated with @AfterScenario(uponOutcome=FAILURE) were not being triggered properly after a scenario failed. Upon further inspection, we see that the Failure is reported by the failing step. It is then ignored by the "After" methods, which report success. The following scenario is run (although it should be skipped). The report at the bottom correctly states that the story failed.
Sample Output from one of the Trader Examples:
Running story org/jbehave/examples/trader/stories/skip_scenarios_after_failure.story
(org/jbehave/examples/trader/stories/skip_scenarios_after_failure.story)
Before Story ...
Scenario: A scenario with failed step
Before Scenario ...
Given I do nothing
Then I fail (FAILED)
(junit.framework.AssertionFailedError: I failed!)
After Any Scenario ...
After Successful Scenario ...
Scenario: A scenario that is not executed because if followed a failed scenario
Before Scenario ...
Given I do nothing
After Any Scenario ...
After Successful Scenario ...
... Browser has been put to rest
After Story ...
Failed to run story org/jbehave/examples/trader/stories/skip_scenarios_after_failure.story
junit.framework.AssertionFailedError: I failed!
Activity
Field | Original Value | New Value |
---|---|---|
Status | Open [ 1 ] | Resolved [ 5 ] |
Assignee | Mauro Talevi [ maurotalevi ] | |
Fix Version/s | 3.2 [ 16757 ] | |
Resolution | Fixed [ 1 ] |
Hi Patrick, it would seem that the failure is reported as it should (hence the output) but the method annotated with outcome FAILURE is not executed. We'll investigate.
Do also bear in mind that the trader stories are actually configured to ignore failures in stories (but not in view) so that the execution of all stories can complete and a collective view of all stories can be generated.