25
Apr

Cucumber – How to execute all feature file which contains a user defined tags from command prompt

Attached is sample maven project for cucumber to demonstrate executing maven project from command prompt:

SampleProjectCucumber

Step 1: import maven project to eclipse

Step 2: perform Maven update to import all dependencies

Step 3: Open “command prompt” and navigate to “hellocucumber” directory (this is project name)

Run a specific story from command prompt:

mvn test -Dcucumber.options=”.\src\test\resources\hellocucumber\is_it_friday_yet.feature”

Run any story which contains user defined tag (say @Jackychan – which is defined in this project)

mvn test -Dcucumber.options=”–tags @Jackychan”

Run all Cucumber runner which matches a pattern:

mvn test -Dtest=Run*Test //<== This will execute RunCucumberTest.java