You can specify system properties in the maven configuration:
http://jbehave.org/reference/stable/maven-goals.html
On 12/03/2013 19:40, Senthil Kumar T wrote:
Hi,
This issue is still exist. (Last time, I run test as junit test from
eclipse, it was running, didn't run through console maven goal).
Though I added test scope in plugin's configuration, my test scope
dependencies are not considered, still getting ClassNotFoundException
for my mockito classes.
Also the other thing i am not able to pass system properties from
maven pom file to my test class.
Our integration tests are run by maven-surefire-plugin, we declare the
below tags in pom.xml
<configuration>
<systemPropertyVariables>
<runtime.env>tst</runtime.env>
</systemPropertyVariables>
<configuration>
So the *runtime.env* property will go to my test class, and where I
load a spring context file (which requires the property available).
All is well.
But jbehave acceptance tests are executed by jbehave-maven-plugin, I
wanted to configure the below in jbehave-plugin configuration element
<configuration>
<systemPropertyVariables>
<runtime.env>tst</runtime.env>
</systemPropertyVariables>
<configuration>
Doesn't work, because AbstractEmbedderMojo doesn't receive
systemPropertyVariables.
I also tried
<configuration>
<systemProperties>
<runtime.env>tst</runtime.env>
</systemProperties>
<configuration>
This also not working. my variables are not passed to test class.
Currently I am forced to use either option 1)
System.setProperty("runtime.env", "tst");
stepsFactory = new SpringStepsFactory(configuration, new
ClassPathXmlApplicationContext("context.xml", "steps.xml"));
NOT OK solution - code is tied to executable enviornment.
option 2)
while running in the maven goal, passing property using -D
mvn clean install etc etc -Druntime.env=tst
OK, but looking for pom.xml way of passing. Because our project
contains many modules, jbehave tests are in one module, we will run
tests from parent directory to ensure all modules running. Just for
jbehave-tests, passing the extra parameter, and updating CI build
configuration is not preferable.
Any help is appreciated. Thanks
On Mon, Mar 4, 2013 at 4:37 PM, Senthil Kumar T <senthili...@gmail.com
<mailto:senthili...@gmail.com>> wrote:
Thanks, adding <scope> test<scope> in plugin configuration works
well.
Regards
Senthil
On Sat, Mar 2, 2013 at 5:48 AM, Mauro Talevi
<mauro.tal...@aquilonia.org <mailto:mauro.tal...@aquilonia.org>>
wrote:
Hi,
by default, compile-scope dependencies are used. If you want
test-scoped, you need to specify in your plugin
<configuration> element :
<scope>test</scope>
Cheers
On 01/03/2013 22:25, Senthil Kumar T wrote:
Hi,
I have mockito dependency with test scope (inherited from
parent pom). When I run mvn clean install. The
jbehave-maven-plugin runs my stories. I configured
"run-stories-as-embeddables" goal to run.
But I got classNotFoundExcepiton for mockito classes.
mockito library is supposed to be used only tests, and I am
running integration-tests. Why those dependencies are not
passed to EmbeederClassLoader.
If I change the scope as runtime/compiletime, then those jars
being passed as classpath elements, and everything working fine.
I am just curious about this issue. Any help is appreciated
Thanks & Regards
Senthil