Better integration with JUnit (Separate results for each story/scenario/example)


I would like each example in each scenario in each story to show up as distinct result in the JUnit test results within my IDE and the JUnit reports. This has the advantage that assertion failures are linked to example failures and can be clicked on in the IDE to jump to source code of the offending failure. Currently I get a single failure in my IDE and have to look through log files or look at the JBehave report.

The current AnnotatedPathRunner implementation extends org.junit.runners.BlockJUnit4ClassRunner and therefore uses the methods with a @Test annotation to drive the JUnit results. In most jbehave tests, there is only one such method which means that there is only a single result in the JUnit reports (IDE and HTML).

I have started to implement a new org.junit.runner.Runner implementation which extends org.junit.runners.ParentRunner and can use the stories as the basis for generating the JUnit test results rather than the Test case itself.

I have attached a screenshot and source code for running a single test (jbehave.ListTest) in Eclipse. The test case runs a single story (list.story). You can see from the results that there is a hierarchy in the JUnit results for story, scenario and example.


Mauro Talevi






Fix versions

Affects versions