[
https://jira.codehaus.org/browse/JBEHAVE-551?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=272643#comment-272643
]
Lance commented on JBEHAVE-551:
-------------------------------
I feel that my JBehaveRunner implementation has more similar behaviour to
standard JUnit testing because:
1. You get a new instance of the test case (and the steps) for every test
execution.
2. Methods annotated with @Before (org.junit.Before) will run before every test
execution
3. Methods annotated with @After (org.junit.After) will run after every test
execution
My current JBehaveTestRunner implementation supports all of the JBehave
annotations and also supports two new annotations (@BeforeExample and
@AfterExample)
There are a couple of issues with these annotations with my JBehaveRunner
implementation
4. A test instance is required to retrieve the first steps collection
5. A test instance is required for each story (@BeforeStory and @AfterStory)
6. A test instance is required for each scenario (@BeforeScenario and
@AfterScenario [and @Steps, @Before and @After if there are no examples])
7. A test instance is required for each example (@BeforeExample, @AfterExample,
@Steps, @Before, @After)
Currently 4, 5, 6 and 7 generate a separate test instance (which is shared
between the annotations mentioned).
Suggestions:
8. Any methods annotated with @BeforeStory and @AfterStorymust be static
(similar to @BeforeClass and @AfterClass) therefore no test instance required.
9. For scenarios with no examples, any methods annotated with @BeforeScenario
and @AfterScenario must be static.
10. Or we could get rid of all of the JBehave annotations and assume that
@BeforeClass, @AfterClass and @Before and @After are sufficient
> Better integration with JUnit (Separate results for each
> story/scenario/example)
> --------------------------------------------------------------------------------
>
> Key: JBEHAVE-551
> URL: https://jira.codehaus.org/browse/JBEHAVE-551
> Project: JBehave
> Issue Type: Improvement
> Components: Core
> Affects Versions: 3.4.5
> Reporter: Lance
> Assignee: Mauro Talevi
> Fix For: 3.5
>
> Attachments: eclipse-screenshot.jpg,
> jbehave-improved-junit-runner.zip, jbehave-parent-runner-src.zip
>
>
> 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.
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email