17

How is it possible to use the cucumber feature option from maven command line.
Of a tree full of features (tests), I'm trying to run only individual features. In my case - all feature files in a selected folder.

I've tried to use the following syntax:

mvn install -Dcucumber.options="classpath:com/company/regression/features/administration/"

It runs all tests. No errors and no comments.
I tried several other options and none worked!

Any help here will be greatly appreciated.

1 Answer 1

30

I changed my approach, and decided to use tags instead.
Now, I run a command that tells me which tags to use and I make sure to put a special tag at the beginning of the feature file.
My command now looks like:

mvn install -Dcucumber.options="--tags @runThis --tags ~@ignore --format json-pretty:target/cucumber-report-myReport.json --format html:target/cucumber-html-report-myReport"

The tag I put is @runThis and the ~@ignore is to tell cucumber not to run the @ignore tags.
I also create a different report for each run, so Jenkins cucumber plugin can create a single report from all the different runs and they don't overwrite each other.

I hope this helps.

1
  • While running from maven terminal I used the following command to achieve cucumber parallelism using Cucumber Parallel JVM plugin. mvn install -Dcucumber.options="--tags @Smoke --tags @Regression" but it failed to execute. ~[Didn't generate the Dynamic runner file itself]~ But executing with single tag is working mvn install -Dcucumber.options="--tags @Smoke" What could be the solution to over come this? Commented Jul 4, 2018 at 7:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.