JBehave
  1. JBehave
  2. JBEHAVE-407

Failing Scenarios are Reported as Successfull

    Details

    • Type: Bug Bug
    • Status: Resolved Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 3.2
    • Fix Version/s: 3.2
    • Component/s: Core
    • Labels:
      None
    • Environment:
      Win XP
    • Number of attachments :
      0

      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

        Hide
        Mauro Talevi added a comment -

        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.

        Show
        Mauro Talevi added a comment - 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.
        Hide
        Mauro Talevi added a comment -

        Fixed - added story to verify behaviour: org/jbehave/examples/trader/stories/after_scenario_outcome.story

        Show
        Mauro Talevi added a comment - Fixed - added story to verify behaviour: org/jbehave/examples/trader/stories/after_scenario_outcome.story
        Mauro Talevi made changes -
        Field Original Value New Value
        Status Open [ 1 ] Resolved [ 5 ]
        Assignee Mauro Talevi [ maurotalevi ]
        Fix Version/s 3.2 [ 16757 ]
        Resolution Fixed [ 1 ]
        Hide
        Vicki Sainz added a comment -

        Mauro,
        Did you actually drop a fix for this or just change the test to find the issue?
        Our tests were running a screenshot command upon failure, and when I upgraded from 3.1.1 to 3.1.2 this stopped working.
        Thanks and regards,
        Vicki

        Show
        Vicki Sainz added a comment - Mauro, Did you actually drop a fix for this or just change the test to find the issue? Our tests were running a screenshot command upon failure, and when I upgraded from 3.1.1 to 3.1.2 this stopped working. Thanks and regards, Vicki
        Hide
        Mauro Talevi added a comment -

        Not yet released, we'll push out a new beta of 3.2 by the end of the week.

        Show
        Mauro Talevi added a comment - Not yet released, we'll push out a new beta of 3.2 by the end of the week.

          People

          • Assignee:
            Mauro Talevi
            Reporter:
            Patrick McFadden
          • Votes:
            1 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: