When it is necessary to override the options mentioned in the JUnit Runner, then we need Dcucumber.options
from the Terminal. Let's look at some of the practical examples.
If we want to run a Scenario by specifying the filesystem path, run the following command and look at the output:
mvn test -Dcucumber.options="src/test/java/com/features/sample.feature:5"
In the preceding code, "
5
" is the Feature file line number where a Scenario starts.If we want to run the test cases using Tags, then we run the following command and notice the output:
mvn test -Dcucumber.options="--tags @sanity"
The following is the output of the preceding command:
If we want to generate a different report, then we can use the following command and see the JUnit report generate at the location mentioned:
mvn test -Dcucumber.options="--plugin junit:target/cucumber-junit-report.xml"