Re: [jbehave-user] Better JUnit reporting result view
Hello Andreas, thank you, this works. I had used JUnitReportingRunner.recommandedControls(configuredEmbedder()) in the beginning, but had a StackOverflowError. Now I discovered that I have misplaced this code line. But I get another error now: java.lang.NullPointerException at de.codecentric.jbehave.junit.monitoring.JUnitScenarioReporter.example(JUnitScenarioReporter.java:187) at org.jbehave.core.reporters.DelegatingStoryReporter.example(DelegatingStoryReporter.java:85) at org.jbehave.core.reporters.ConcurrentStoryReporter.example(ConcurrentStoryReporter.java:197) at org.jbehave.core.embedder.StoryRunner.runScenariosParametrisedByExamples(StoryRunner.java:405) at org.jbehave.core.embedder.StoryRunner.runCancellable(StoryRunner.java:301) at org.jbehave.core.embedder.StoryRunner.run(StoryRunner.java:219) at org.jbehave.core.embedder.StoryRunner.runGivenStories(StoryRunner.java:386) at org.jbehave.core.embedder.StoryRunner.runCancellable(StoryRunner.java:270) at org.jbehave.core.embedder.StoryRunner.run(StoryRunner.java:219) at org.jbehave.core.embedder.StoryRunner.run(StoryRunner.java:180) at org.jbehave.core.embedder.StoryManager$EnqueuedStory.call(StoryManager.java:229) at org.jbehave.core.embedder.StoryManager$EnqueuedStory.call(StoryManager.java:201) at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334) at java.util.concurrent.FutureTask.run(FutureTask.java:166) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) at java.lang.Thread.run(Thread.java:724) The actions are not executed because of this. Nevertheless the JUnit view says the test is a success. No, really, JUnitReportingRunner is not reliable at all for me. Even without these bugs and tricky configurations of it, the information it shows in the JUnit view are wrong since it does not show the given stories. Because of this I will not use it. I need a reliable and complete test result, so I will look into the JBehave result protocol. 2013/9/30 Andreas Ebbert-Karroum andreas.ebbert-karr...@codecentric.de Hi Alex, I'd love to do that as well! However, this is (to the best of my knowledge) not possible due to some limitiations in JUnit and the JUnit-View in eclipse itself. Let's see if I remember correctly what happens: A JUnit-Test maps to a step, a suite to a scenario or story. Every unit test in JUnit is only executed once, while steps can be executed possibly multiple times. That's why we have something like a name uniquifier that appends invisible characters, if a step is used multiple times. But, the methods in JUnit to construct Descriptions only take a class and a name as String, and that name has to be unique. Hence, I could no map it to a method name, that is potentially not unique. See the method addSuite in the very end: https://github.com/codecentric/jbehave-junit-runner/blob/master/src/main/java/de/codecentric/jbehave/junit/monitoring/JUnitReportingRunner.java And JUnits API docs: http://www.cs.rice.edu/~javaplt/javadoc/junit4.4/org/junit/runner/Description.html But, since this is open source. If you can figure out a way, by all means, let us know, send a pull request, whatever. I'd love to have that feature! Kind Regards, Andreas 2013/9/30 Alex Filatau fila...@gmail.com Sorry for a bit of off topic, but jbehave-junit-runner is indeed great addition for running JBehave tests and I'd vote for inclusion of it into standard package if it's proper place to do so. The only thing I'd love to see there now is ability to go to the step candidate definition by click in the JUnit report in Eclipse. Regards, Alex Filatau. On Mon, Sep 30, 2013 at 12:33 AM, Hans Schwäbli bugs.need.love@gmail.com wrote: I wanted to suggest that the JBehave people add such a feature to JBehave. It does not make much sense to me to run it as JUnit test and seeing nearly nothing in the JUnit view but only in the logs. And a good quality of this feature would be more likely. Besides this, the Codecentric addon is not as I expect it. If a story has given stories then the JUnit view does not show the given stories (which must be executed first) but only the actual story. As ist seems Codecentric does not use the GivenStories as they are inteded by JBehave, because they seem to be using them just to read common data (this is how they consulted a cutomer to do). But okay, here is the Stacktrace for you. Maybe you can fix and improve it: Reports view generated with 0 stories (of which 0 pending) containing 0 scenarios (of which 0 pending) java.lang.RuntimeException: org.jbehave.core.embedder.Embedder$RunningStoriesFailed: Failures in running stories: stories/logout.story: org.jbehave.core.embedder.StoryManager$StoryExecutionFailed: stories/logout.story at
Re: [jbehave-user] Better JUnit reporting result view
Hi Hans, do you mind sharing the scenario for which you get the NPE? A wild guess: You have an empty examples table in that scenario. The jbehave-junit-runner usually works fine for valid scenarios and stories. But, there may be bugs, in case you discover one, it'd be extremely nice, if you raise an issue on github: https://github.com/codecentric/jbehave-junit-runner/issues?milestone=nonestate=open Kind Regards, Andreas 2013/10/3 Hans Schwäbli bugs.need.love@gmail.com Hello Andreas, thank you, this works. I had used JUnitReportingRunner.recommandedControls(configuredEmbedder()) in the beginning, but had a StackOverflowError. Now I discovered that I have misplaced this code line. But I get another error now: java.lang.NullPointerException at de.codecentric.jbehave.junit.monitoring.JUnitScenarioReporter.example(JUnitScenarioReporter.java:187) at org.jbehave.core.reporters.DelegatingStoryReporter.example(DelegatingStoryReporter.java:85) at org.jbehave.core.reporters.ConcurrentStoryReporter.example(ConcurrentStoryReporter.java:197) at org.jbehave.core.embedder.StoryRunner.runScenariosParametrisedByExamples(StoryRunner.java:405) at org.jbehave.core.embedder.StoryRunner.runCancellable(StoryRunner.java:301) at org.jbehave.core.embedder.StoryRunner.run(StoryRunner.java:219) at org.jbehave.core.embedder.StoryRunner.runGivenStories(StoryRunner.java:386) at org.jbehave.core.embedder.StoryRunner.runCancellable(StoryRunner.java:270) at org.jbehave.core.embedder.StoryRunner.run(StoryRunner.java:219) at org.jbehave.core.embedder.StoryRunner.run(StoryRunner.java:180) at org.jbehave.core.embedder.StoryManager$EnqueuedStory.call(StoryManager.java:229) at org.jbehave.core.embedder.StoryManager$EnqueuedStory.call(StoryManager.java:201) at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334) at java.util.concurrent.FutureTask.run(FutureTask.java:166) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) at java.lang.Thread.run(Thread.java:724) The actions are not executed because of this. Nevertheless the JUnit view says the test is a success. No, really, JUnitReportingRunner is not reliable at all for me. Even without these bugs and tricky configurations of it, the information it shows in the JUnit view are wrong since it does not show the given stories. Because of this I will not use it. I need a reliable and complete test result, so I will look into the JBehave result protocol. 2013/9/30 Andreas Ebbert-Karroum andreas.ebbert-karr...@codecentric.de Hi Alex, I'd love to do that as well! However, this is (to the best of my knowledge) not possible due to some limitiations in JUnit and the JUnit-View in eclipse itself. Let's see if I remember correctly what happens: A JUnit-Test maps to a step, a suite to a scenario or story. Every unit test in JUnit is only executed once, while steps can be executed possibly multiple times. That's why we have something like a name uniquifier that appends invisible characters, if a step is used multiple times. But, the methods in JUnit to construct Descriptions only take a class and a name as String, and that name has to be unique. Hence, I could no map it to a method name, that is potentially not unique. See the method addSuite in the very end: https://github.com/codecentric/jbehave-junit-runner/blob/master/src/main/java/de/codecentric/jbehave/junit/monitoring/JUnitReportingRunner.java And JUnits API docs: http://www.cs.rice.edu/~javaplt/javadoc/junit4.4/org/junit/runner/Description.html But, since this is open source. If you can figure out a way, by all means, let us know, send a pull request, whatever. I'd love to have that feature! Kind Regards, Andreas 2013/9/30 Alex Filatau fila...@gmail.com Sorry for a bit of off topic, but jbehave-junit-runner is indeed great addition for running JBehave tests and I'd vote for inclusion of it into standard package if it's proper place to do so. The only thing I'd love to see there now is ability to go to the step candidate definition by click in the JUnit report in Eclipse. Regards, Alex Filatau. On Mon, Sep 30, 2013 at 12:33 AM, Hans Schwäbli bugs.need.love@gmail.com wrote: I wanted to suggest that the JBehave people add such a feature to JBehave. It does not make much sense to me to run it as JUnit test and seeing nearly nothing in the JUnit view but only in the logs. And a good quality of this feature would be more likely. Besides this, the Codecentric addon is not as I expect it. If a story has given stories then the JUnit view does not show the given stories (which must be executed first) but only the actual story. As ist seems Codecentric does not use the GivenStories as they are inteded by JBehave, because they seem to be using them just to read common data (this is how they