Hi Enrique,
the JUnitStories is an instance of Embeddable, which provides a facade
to the Embedder:
http://jbehave.org/reference/stable/javadoc/core/org/jbehave/core/Embeddable.html
As outlined in the examples (and in the archetypes as well), the
simplest way to run YourStories (which extends JUnitStories) is the
maven goal run-stories-as-embeddables specifying in the <includes/>
element the path to YourStories java class, e.g. **/YourStories.java. A
typical example is provided on
http://jbehave.org/reference/stable/maven-goals.html.
In this usecase, you don't need to bother about the Embedder, it's
something that's handled under the hood.
Cheers
PS: thanks for your feedback and support.
On 12/07/2012 02:58, Jorge Pombar wrote:
Hello,
As usual let me start with a big thank you for developing such a great
framework.
We started from the jbehave-web-spring-archetype. I have finally
tinkered enough with the configs and are happy with the setup in our
stories (NavitasStories) class that extends JUnitStories, we use this
class as our "Embedder" and run it from Eclipse as a JUnit and
everything works fine. Now I'm working on the POM to setup up the
build and running from cmd line.
I see that you have the different maven goals for running as described
here (http://jbehave.org/reference/stable/maven-goals.html). What we
want to do is run our stories (NavitasStories) class from command line
using maven. We have beans define in our beans.xml file and other
project specific settings defined on NavitasStories hence we don't
want to run with the plain "Embedder" used by the goals.
For simplicity I tried doing this using a new project taken from the
archetype so I'm trying to run EtsyDotComStories. I tried adding both
config params <embedderClass> and <injectableEmbedderClass> to the POM
and got the same error of type incompatibility when casting. What I'm
doing wrong? Do I need a new class just for this? I tried searching
for examples but didn't find any
Added to <configuration>:
<embedderClass>foo.EtsyDotComStories</embedderClass> and
<injectableEmbedderClass >foo.EtsyDotComStories</injectableEmbedderClass>
Error from Maven:
[ERROR] Failed to execute goal
org.jbehave:jbehave-maven-plugin:3.6.2:run-stories-as-embeddables
(embeddable-stories) on project sandbox-jbehave-web: A type
incompatibility occured while executing
org.jbehave:jbehave-maven-plugin:3.6.2:run-stories-as-embeddables:
foo.EtsyDotComStories cannot be cast to
org.jbehave.core.InjectableEmbedder
and
[ERROR] Failed to execute goal
org.jbehave:jbehave-maven-plugin:3.6.2:run-stories-as-embeddables
(embeddable-stories) on project sandbox-jbehave-web: A type
incompatibility occured while executing
org.jbehave:jbehave-maven-plugin:3.6.2:run-stories-as-embeddables:
foo.EtsyDotComStories cannot be cast to org.jbehave.core.embedder.Embedder
Thanks,
Enrique