简体   繁体   中英

Setting cucumber-jvm options in Maven from the command line

I am trying to set the "name" option for Cucumber to be able to run a specific feature or scenario.

I have entered this,

mvn test -DCucumber.Options--name="MyFeatureName"

but it just runs all the features and doesn't give an error.

Any ideas?

Here is a snippet from the Cucumber-JVM repo on how to run the java-helloworld example by passing cucumber options:

mvn test -Dcucumber.options="--format json-pretty --glue classpath:cucumber/examples/java/helloworld src/test/resources"

Keep in mind that it will override all the options in the @Cucumber.Options annotation you have on "RunCukesTest". I haven't got it to work for my own tests but maybe this will help.

So it looks like you need to give all the options needed to run cucumber, including the java class path and where the code is located using the "--glue" parameter.

您的测试在单独的JVM中运行,因此您需要在测试插件配置中指定该系统属性(即pom.xml中的surefire或failsafe插件配置)。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM