I found a solution. Good that it is open source, so I can look into the
code to find answers.

As it seems "org.jbehave.core.Embeddable.useEmbedder(Embedder)" is called a
bit late in the execution process. If I overwrite
"org.jbehave.core.junit.JUnitStories.run()" and get the system properties
from there, then it works.

Maybe useEmbedder(...) could be called earlier by JBehave. The embeddable
instances are created in the method:
org.jbehave.core.embedder.Embedder.embeddables(List<String>,
EmbedderClassLoader)

An Embedder object could be passed into this method and right after
instantiating a new embeddable, the method "useEmbedder(...)" could be
called. Then one could use configuredEmbedder() even in the constructor of
his embeddable class without getting just an inital embedder. This is just
a possible suggestion, I didn't analyse it completely.


2013/10/8 Hans Schwäbli <[email protected]>

> I set a system property according to this description:
> http://jbehave.org/reference/stable/maven-goals.html
>
> But I could not figure out how to use it then, starting it with Maven
> goals clean and integration-test.
>
> I extend JUnitStories. In that class I try to access the property in the
> constructor with:
> String dryRun =
> configuredEmbedder().systemProperties().getProperty("dry.run");
>
> But "dryRun" is null although it is really set by Maven if I look into the
> console log.
>
> The confgured embedder is not the same like the configuration in the POM
> file for some reason but a kind of initial default embedder.
>
> System.getProperty("dry.run") does not work either.
>
> How to get to the fruit?
>

Reply via email to