Running Cucumber from the Terminal
Now we have integrated Cucumber with Maven, running Cucumber from the Terminal will not be a problem. Running any test framework from the Terminal has its own advantages, such as overriding the run configurations mentioned in the code.
So how do we run Cucumber test cases from the Terminal? Let's find out in our next section.
How to do it…
Open the command prompt and
cd
until the project root directory.First, let's run all the Cucumber Scenarios from the command prompt. Since it's a Maven project and we have added Cucumber in test scope dependency and all features are also added in test packages, run the following command in the command prompt:
mvn test
This is the output:
The previous command runs everything as mentioned in the JUnit Runner class. However, if we want to override the configurations mentioned in the Runner, then we need to use following command:
mvn test –DCucumber.options="<<OPTIONS>>"
If you need help on these Cucumber options...