JBehave
  1. JBehave
  2. JBEHAVE-970

Tests do not fail when Spring context fails to load

    Details

    • Number of attachments :
      0

      Description

      When the creation of the Spring context fails, because resources cannot be found, beans cannot be created or some other configuration issue, the tests is not run but the result does not reflect this properly. Therefore Maven and Jenkins think tests are successful which gives a false positive. When nobody looks at the logs, nobody will see there is actually an error.

      Cloned JBehave repo and fixed issue in: https://github.com/diversit/jbehave-core/commit/275f609a8faf2dfb2ee4feaa1be0351accbd9992

        Activity

        Joost den Boer made changes -
        Field Original Value New Value
        Description When the creation of the Spring context fails, because resources cannot be found, beans cannot be created or some other configuration issue, the tests is not run but the result does not reflect this properly. Therefore Maven and Jenkins think tests are successful which gives a false positive. When nobody looks at the logs, nobody will see there is actually an error. When the creation of the Spring context fails, because resources cannot be found, beans cannot be created or some other configuration issue, the tests is not run but the result does not reflect this properly. Therefore Maven and Jenkins think tests are successful which gives a false positive. When nobody looks at the logs, nobody will see there is actually an error.

        Cloned JBehave repo and fixed issue in: https://github.com/diversit/jbehave-core/commit/275f609a8faf2dfb2ee4feaa1be0351accbd9992
        Hide
        Joost den Boer added a comment -

        I created a simple fix by having SpringAnnotationBuilder also throw an InstantiationFailed exception, just as AnnotationBuilder class does in some places.

        However, I think this should actually be fixed in the JBehave core. The tests should not be started when errors have already been registered in the AnnotationMonitor. But this is probably more complex to change then what I now did to fix this issue.

        Show
        Joost den Boer added a comment - I created a simple fix by having SpringAnnotationBuilder also throw an InstantiationFailed exception, just as AnnotationBuilder class does in some places. However, I think this should actually be fixed in the JBehave core. The tests should not be started when errors have already been registered in the AnnotationMonitor. But this is probably more complex to change then what I now did to fix this issue.
        Mauro Talevi made changes -
        Fix Version/s 3.9.1 [ 19830 ]
        Hide
        Mauro Talevi added a comment -

        Applied patch with thanks.

        Made behaviour configurable via the annotation flag

        @UsingSpring(ignoreContextFailure="true|false")

        Default is true for backward compatibility. We can readdress this in 4.0.

        Show
        Mauro Talevi added a comment - Applied patch with thanks. Made behaviour configurable via the annotation flag @UsingSpring(ignoreContextFailure="true|false") Default is true for backward compatibility. We can readdress this in 4.0.
        Mauro Talevi made changes -
        Resolution Fixed [ 1 ]
        Status Open [ 1 ] Resolved [ 5 ]
        Hide
        Joost den Boer added a comment -

        Mauro,

        Thanks for applying the patch.
        However, I do not agree with the added backwards compatibility change. This issue is clearly a bug. I cannot think of anyone who would not want the tests to fail when the context does not load. Excuse me for being blunt, but having a property to enable/disable a bug-fix is so IBM-like.

        Now we still have to change our test code for JBehave to behave as we want it, and as it should be (I think).
        This issue should be fixed for everyone without having to set a feature switch.

        Show
        Joost den Boer added a comment - Mauro, Thanks for applying the patch. However, I do not agree with the added backwards compatibility change. This issue is clearly a bug. I cannot think of anyone who would not want the tests to fail when the context does not load. Excuse me for being blunt, but having a property to enable/disable a bug-fix is so IBM-like. Now we still have to change our test code for JBehave to behave as we want it, and as it should be (I think). This issue should be fixed for everyone without having to set a feature switch.

          People

          • Assignee:
            Unassigned
            Reporter:
            Joost den Boer
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Time Tracking

              Estimated:
              Original Estimate - 1 hour
              1h
              Remaining:
              Remaining Estimate - 1 hour
              1h
              Logged:
              Time Spent - Not Specified
              Not Specified