Re: [jbehave-user] Better JUnit reporting result view

2013-10-04 Thread Hans Schwäbli
Hello Andreas,

If this becomes a part of JBehave I would share the scenario, but since I
don't intend to use it (because of the reasons I wrote earlier), I cannot
do that. I work in the financial industry and must be very careful what I
share (which means spend extra time to be sure that it contains nothing
confidential). Sorry.


2013/10/3 Andreas Ebbert-Karroum andreas.ebbert-karr...@codecentric.de

 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
 

[jbehave-user] Parsing GivenStories

2013-10-04 Thread Andreas Ebbert-Karroum
Hi,

as Hans correctly pointed out in a recent post, the jbehave-junit-runner
currently ignores the given stories. I agree that this is a feature, that
is desireable to have. When we wrote the extension to JBehave, we have not
implemented that, since we thought - and still think - that the
jbehave-junit-runner provided enough value to be released. But the time has
come to think about including that feature.

Now, the way the jbehave-junit-runner works is that it needs to know all
stories, scenarios and steps, before the execution starts, in order to
forward that information to JUnit, so that it knows how many and which
tests to expect.

I do have access to the Story object, but from there I only get the given
stories as paths and probably need to parse them myself. Can somebody point
me to some source code in the original JBehave sources how that should be
done best?

Here's the class that generates the JUnit description objects:

https://github.com/codecentric/jbehave-junit-runner/blob/master/src/main/java/de/codecentric/jbehave/junit/monitoring/JUnitDescriptionGenerator.java

The method should include a addAllGivenStories(...) in between.

public Description createDescriptionFrom(Story story) {
Description storyDescription = createDescriptionForStory(story);
addAllScenariosToDescription(story, storyDescription);
return storyDescription;

}

​​
​Thanks for your help!​


-- 
Mit freundlichen Grüßen / Best regards

Andreas Ebbert-Karroum | Agile Principal Consultant

codecentric AG | Merscheider Straße 1 | 42699 Solingen | Deutschland
tel: +49 (0) 212.23362825 | fax: +49 (0) 212.23362879 | mobil: +49 (0)
175.2664109
www.codecentric.de | blog.codecentric.de | www.meettheexperts.de |
www.more4fi.de

Sitz der Gesellschaft: Düsseldorf | HRB 63043
Vorstand: Klaus Jäger (Vorsitzender) . Michael Hochgürtel . Mirko Novakovic
. Rainer Vehns
Aufsichtsrat: Patric Fedlmeier (Vorsitzender) . Bernd Klinkmann . Jürgen
Schütz

Diese E-Mail einschließlich evtl. beigefügter Dateien enthält vertrauliche
und/oder rechtlich geschützte Informationen. Wenn Sie nicht der richtige
Adressat sind oder diese E-Mail irrtümlich erhalten haben, informieren Sie
bitte sofort den Absender und löschen Sie diese E-Mail und evtl.
beigefügter Dateien umgehend. Das unerlaubte Kopieren, Nutzen oder Öffnen
evtl. beigefügter Dateien sowie die unbefugte Weitergabe dieser E-Mail ist
nicht gestattet.


Re: [jbehave-user] Better JUnit reporting result view

2013-10-04 Thread Andreas Ebbert-Karroum
Hi Hans,

it would have been perfectly sufficient to say if you had an empty examples
table in your scenario that produced that error.

Thanks,
Andreas


2013/10/4 Hans Schwäbli bugs.need.love@gmail.com

 Hello Andreas,

 If this becomes a part of JBehave I would share the scenario, but since I
 don't intend to use it (because of the reasons I wrote earlier), I cannot
 do that. I work in the financial industry and must be very careful what I
 share (which means spend extra time to be sure that it contains nothing
 confidential). Sorry.


 2013/10/3 Andreas Ebbert-Karroum andreas.ebbert-karr...@codecentric.de

 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:

 

Re: [jbehave-user] Story language settings improvement suggestion

2013-10-04 Thread Cristiano Gavião
good code contributions are always welcomed !


2013/10/4 Hans Schwäbli bugs.need.love@gmail.com

 I tried to use JBehave with German language.

 Then I discovered that you have to configure a lot to achieve this.

 This is because you have to create a Keywords object and set it into many
 other objects. See
 http://jbehave.org/reference/stable/stories-in-your-language.html

 If you forget to set the Keyword object into one of the other objects,
 then it does not work correctly, tests fail. Or if JBehave is changed in a
 future version, your language configuration might not work anymore.

 Furthermore you need to configure that in the Eclipse plugin.

 I think this could be made much simpler. Can you make setting a language
 simpler please (suggestion)?

 The Eclipse plugin could detect the language of the story files
 automatically by default for instance.

 And there could be made a JBehave utility method (and maintained in the
 JBehave Core project) which sets the language into all required objects. Or
 it could even auto-detect the language (according to the translations
 shipped which JBehave) by default.

 This is just a suggestion.




-- 
Tudo vale a pena se a alma não é pequena...


[jbehave-user] Result report with css files and images, how to do?

2013-10-04 Thread Hans Schwäbli
The test result report of JBehave are HTML files.

Unfortunately the referenced images and CSS file is not present in the
target folder.

I spend quite some time figuring out how to add these resources by some
Maven configuration, but I could not get it working.

Is there a small example for dummies showing how to do it? Please with no
parents, really simple POM file or snippet please.


Re: [jbehave-user] Better JUnit reporting result view

2013-10-04 Thread Hans Schwäbli
I think I have no empty example table. My example tables are not empty.

It works as expected without that JUnitReportRunner. Only with
JUnitReportRunner I get a NPE.


2013/10/4 Andreas Ebbert-Karroum andreas.ebbert-karr...@codecentric.de

 Hi Hans,

 it would have been perfectly sufficient to say if you had an empty
 examples table in your scenario that produced that error.

 Thanks,
 Andreas


 2013/10/4 Hans Schwäbli bugs.need.love@gmail.com

 Hello Andreas,

 If this becomes a part of JBehave I would share the scenario, but since I
 don't intend to use it (because of the reasons I wrote earlier), I cannot
 do that. I work in the financial industry and must be very careful what I
 share (which means spend extra time to be sure that it contains nothing
 confidential). Sorry.


 2013/10/3 Andreas Ebbert-Karroum andreas.ebbert-karr...@codecentric.de

 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. 

Re: [jbehave-user] Result report with css files and images, how to do?

2013-10-04 Thread Alex Filatau
I might be missing the question, but that's what working for me out of the
box, by deploying jbehave with maven artifact.
You need following dependency:

dependency

 groupIdorg.jbehave.site/groupId

 artifactIdjbehave-site-resources/artifactId

 version${jbehave.site.version}/version

 typezip/type

 /dependency

And then you need for your jbehave-maven-plugin add following execution:


  execution

   idunpack-view-resources/id

   phaseprocess-resources/phase

   goals

   goalunpack-view-resources/goal

   /goals

   /execution


That's it. It results in target/jbehave directory to get images and css etc
in my case.

Or were you asking about customization of all this?


Regards,

Alex Filatau.


On Fri, Oct 4, 2013 at 7:54 AM, Hans Schwäbli
bugs.need.love@gmail.comwrote:

 The test result report of JBehave are HTML files.

 Unfortunately the referenced images and CSS file is not present in the
 target folder.

 I spend quite some time figuring out how to add these resources by some
 Maven configuration, but I could not get it working.

 Is there a small example for dummies showing how to do it? Please with no
 parents, really simple POM file or snippet please.