Details
-
Type: Improvement
-
Status: Open
-
Priority: Major
-
Resolution: Unresolved
-
Affects Version/s: None
-
Fix Version/s: None
-
Component/s: Core
-
Labels:None
-
Environment:All
-
Number of attachments :
Description
I've been thinking about how JBehave handles assertion failures.
As it works today, JBehave behaves something like this when it encounters a failing assertion:
Given I have searched for a round-trip flight
When I view my trip summary
Then I should see the origin and destination of each flight segment
And I should see the fare cost (FAILED)
And I should see the taxes and fees (NOT RUN)
And I should see the on-time rating of each flight segment (NOT RUN)
Test Failed!
I'd like to have the results look like this:
Given I have searched for a round-trip flight
When I view my trip summary
Then I should see the origin and destination of each flight segment
And I should see the fare cost (FAILED)
And I should see the taxes and fees
And I should see the on-time rating of each flight segment (FAILED)
Test Failed!
I'm finding that most assertions in a functional test need not halt test execution and it would be nice to have the test run "until it can't." If the fare cost doesn't get fixed for weeks, that won't hide the broken on-time ratings.
For JBehave, I believe that the change would entail recording and swallowing assertion exceptions while failing on other sorts of exceptions. If selenium can't find the continue button, it will throw a NoSuchElementException and halt the test.
If this does get implemented, I think that it would be useful to have some sort of before/after step hooks, so that we can take screenshots for each failing assertion.
It would be nice to have something like: @AfterStep(FAILING)
I think there's a difference (as you allude) between RuntimeException and AsserionError derivatives.
The former happening in THEN steps should cease further step invocation. The latter happening, seems to be part of the intent of testing, and it should be OK to continue with more THEN steps (but no further if there were another WHEN step after for the same scenario)
I think if should be the default behavior for JBehave, and that somewhere (in config) it should be turned off.