How to Run Single Cucumber Feature Files Through Command Prompt and Through Jenkins Using Maven

Maven running cucumber specific feature files or folders

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.

How to target specific Cucumber runner classes or feature files within Jenkins?

You can tag your test cases and maven will be able to run them by these tags.

For example, When I have Login cases with @Login tags and I want to run them with Maven, I am using the following terminal script :

mvn clean test -Dcucumber.options="--tags @Login"


Related Topics



Leave a reply



Submit