Alex Bepple

1 note &

More sensible reporting behavior for JBehave 3.0

Going from 2.5 to 3.0, JBehave changed its default reporting behavior – unfortunately, for the worse. Out of the box, JBehave 2.5

  • succeeded and remained silent, if all steps were implemented and passed,
  • succeeded and printed all the steps of a scenario, if at least one step was not implemented – marking that step as pending – and no executed step failed, and
  • failed and printed all the steps of a scenario, if a step failed – marking that step.

JBehave 3.0, on the other hand,

  • succeeds and fails just like JBehave 2.5,
  • but never tells you anything. There is a stacktrace in case of a failure. But who wants to read those? And you get no clue what so ever as to whether there are pending steps.

So how do you make JBehave 3.0 more verbose? You have to change the configuration in your story class:

  1. disable the useless StoryReporterBuilder, that either does not talk at all or at all times – and is not open to extension :( – and
  2. use a default story reporter that only talks when there is something interesting to say.

You can make this setup even more useful by making pending steps fail:

In one team, we have come up with the convention of committing stories in progress with an @Ignore annotation so as not to disturb other people on the team.

When working on the story, you just remove the @Ignore and the policy of failing pending steps prevents you from checking this in – unless you’re done, of course.

Filed under jbehave it-agile-blog-planet

  1. alexbepple posted this