[WARNING]
java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.codehaus.mojo.exec.ExecJavaMojo$1.run(ExecJavaMojo.java:297)
at java.lang.Thread.run(Thread.java:662)
Caused by: java.lang.NullPointerException
at cucumber.formatter.JUnitFormatter.handleHook(JUnitFormatter.java:116)
at cucumber.formatter.JUnitFormatter.after(JUnitFormatter.java:111)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at cucumber.runtime.Utils$1.call(Utils.java:40)
at cucumber.runtime.Timeout.timeout(Timeout.java:12)
at cucumber.runtime.Utils.invoke(Utils.java:36)
at cucumber.runtime.RuntimeOptions$2.invoke(RuntimeOptions.java:119)
at $Proxy26.after(Unknown Source)
at cucumber.runtime.Runtime.runHookIfTagsMatch(Runtime.java:206)
at cucumber.runtime.Runtime.runHooks(Runtime.java:184)
at cucumber.runtime.Runtime.runAfterHooks(Runtime.java:179)
at cucumber.runtime.model.CucumberScenario.run(CucumberScenario.java:38)
at cucumber.runtime.model.CucumberFeature.run(CucumberFeature.java:112)
at cucumber.runtime.Runtime.run(Runtime.java:105)
at cucumber.runtime.Runtime.run(Runtime.java:93)
at cucumber.cli.Main.run(Main.java:20)
at cucumber.cli.Main.main(Main.java:12)
When I running my tests with jUnit everything looks fine but I cannot pass tag parameter from maven. How I should do this?
Also I was trying to create one more junit runner class RunCuke.java class where differnt tags where specified. But when running "mvn clean test -DRunCuke" tests did not run.
T E S T S
-------------------------------------------------------
Results :
Tests run: 0, Failures: 0, Errors: 0, Skipped: 0
On Wed, Sep 5, 2012 at 11h44, aslak hellesoy <aslak.h...@gmail.com> wrote:
>
> When using the JUnit runner, you have to pass the tags with
> @Cucumber.Options(tags={"@foo", "@bar"})
>
> This can be overridden by defining the *special* cucumber.options
> system property that Cucumber-JVM will parse if defined.
> Beware that cucumber.options currently overrides the entire command
> line generated from the @Cucumber.Options annotation.
Interestingly this is something I have recently hit when rewriting my cucumber-jvm example (http://www.weblogism.com/item/334/integration-tests-with-cucumber-jvm-selenium-and-maven) using tags.
Not sure whether this is something you feel strongly about, but I have just submitted a pull request (https://github.com/cucumber/cucumber-jvm/pull/388) to alter that behaviour, as I think it is not correct in the case of junit. Firstly because the logic for JUnit without system properties is to set default glue and feature paths when none is set -- and setting system properties break that behaviour -- , and secondly (arguably less important, though) because it makes the definition of Maven pom a bit more messy, as you have to specify glue and feature paths which should be "guessed" from the JUnit classes.
Is that behaviour "by design"?
Regards,
Sebastien.
<dependency><groupId>info.cukes</groupId><artifactId>cucumber-java</artifactId><version>1.0.9</version><scope>test</scope></dependency><dependency><groupId>info.cukes</groupId><artifactId>cucumber-junit</artifactId><version>1.0.9</version><scope>test</scope></dependency>I am trying to use mvn clean test -Dtags="@Test1"I want the above maven command to be used for TEst2, Test3 tags at same time in different machinesbut unfortunately its picking what i ve given in the Cucumber.Options in RunCukeTest.JAvaAny help on this will be much appreciated
I don't think Cucumber-JVM supports cucumber.yml, that's a ruby thing.
I think I have a better solution for you than running from command line and specifying tags. Use tags specified in the junit test annotation.SpecialTest.java:@RunWith(Cucumber.class)@Cucumber.Options(tags = "@special")public class SpecialTest { }That will run all your scenarios that have the @special annotation. You haven't provided any source, so you need to put in the correct features and other Options in. Then you run just that one test withmvn test -Dtest=SpecialTestIf this test should not be run with other tests, say for example your other tests specifically exclude @special tests (with tags = "~@special") then you can exclude this test from running by default. In your maven surefire config in build:
<plugin><groupId>org.apache.maven.plugins</groupId><artifactId>maven-surefire-plugin</artifactId><version>${maven-surefire-plugin.version}</version><configuration><excludes><exclude>**/SpecialTest.java</exclude></excludes></configuration></plugin>FYI you can also "include" specific tests; you could make it by default inclusive, or exclusive.I haven't actually tested the above build config; you may have to do something with profiles to be able to run different test classes. In fact that might be better: a maven profile that just runs that one test class, overriding the default behaviour.
cucumber.options
System property will no longer completely override all arguments set in @Cucumber.Options
or on the command line. Instead, it will keep those and only override those that are specified in cucumber.options
. Special cases are --tags
, --name
and path:line
, which will override previous tags/names/lines. To override a boolean option (options that don't take arguments like --monochrome
), use the --no-
counterpart (--no-monochrome
). (#388 Sébastien Le Callonnec, Aslak Hellesøy)Aslak,Thanks for the reply,I am not sure how do i use this DCucumber.Options.
I am using Cucumber JVM with Junitwith out updating the RunCukesTest.Java. Can i execute the tests from command promptlike mvn clean test -Dtags= @xxxi don;t use cucumber.yml. i used MavenCheersVinod M
On Tuesday, September 4, 2012 9:48:36 PM UTC+1, Andrii Dzynia wrote:HI all,I have tried all the combinations to run maven with tags. I was just sucessful with tag annonation inside Java class and ant call. Tag parameter is not passing by maven. Who was succesful with running specific tag by maven could you please send an example of pom and run command please?
--
Hi Aslak,I tried DCucumber.Options