JBehave
  1. JBehave
  2. JBEHAVE-145

Unit-test runners should decorate Exceptions a bit more clearly

    Details

    • Type: Improvement Improvement
    • Status: Resolved Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.1
    • Fix Version/s: 2.2
    • Component/s: None
    • Labels:
      None
    • Number of attachments :
      1

      Description

      Somewhere deep down in the runScenario logic, you could benefit from a try/catch(Throwable)/wrap-rethrow

      The wrapping exception could add textual information on the step that is failing. Catch throwable because you're not just catching AssertionErrors, you're catching Selenium timeouts.

        Activity

        Mauro Talevi made changes -
        Field Original Value New Value
        Summary Can JUnit 3, 4, TestNG test-runners decorate Exceptions a bit more clearly ? Unit-test runners should decorate Exceptions a bit more clearly
        Fix Version/s 2.2 [ 14670 ]
        Hide
        Mauro Talevi added a comment -

        Paul - can you please provide an example or a patch detailing what you mean by "a bit more clearly"?

        Show
        Mauro Talevi added a comment - Paul - can you please provide an example or a patch detailing what you mean by "a bit more clearly"?
        Hide
        Phil Wills added a comment -

        I'm attaching a patch which I think addresses to some extent what Paul is describing. Ideally I think this would be done with an ErrorStrategy, rather than a ScenarioReporter, but that doesn't seem achievable with the interfaces as they stand.

        Show
        Phil Wills added a comment - I'm attaching a patch which I think addresses to some extent what Paul is describing. Ideally I think this would be done with an ErrorStrategy, rather than a ScenarioReporter, but that doesn't seem achievable with the interfaces as they stand.
        Phil Wills made changes -
        Attachment step_in_exception.txt [ 39202 ]
        Hide
        Mauro Talevi added a comment -

        Phil, applied patch with thanks. I've renamed decorator to StepFailureScenarioReporterDecorator and made StepFailure extend RuntimeException. I also nullified the failure before each story.

        As this is a decorator and does not impact any existing functionality, I think we can release as is and improve on it in the following release, also looking at how we can possibly implement via ErrorStrategy.

        Show
        Mauro Talevi added a comment - Phil, applied patch with thanks. I've renamed decorator to StepFailureScenarioReporterDecorator and made StepFailure extend RuntimeException. I also nullified the failure before each story. As this is a decorator and does not impact any existing functionality, I think we can release as is and improve on it in the following release, also looking at how we can possibly implement via ErrorStrategy.
        Mauro Talevi made changes -
        Resolution Fixed [ 1 ]
        Status Open [ 1 ] Resolved [ 5 ]

          People

          • Assignee:
            Unassigned
            Reporter:
            Paul Hammant
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: