Search code examples
javaseleniummavenautomated-testscucumber

Running Java/Selenium/Cucumber tests via command line


I have a test project built in Intellij IDEA 2021.1 using Selenium, Cucumber and Maven The project runs fine from within Intellij but now I want to call the tests from the command line and only those with a specific tag. Below is the project layout

enter image description here

There is only 1 feature file at present and I only want to call the scenarios with the "regression" tag from the command line.

I have run command line with Visual Studio/Selenium in the past but this is my first go with Java so any advice on how to get this started would be great.


Solution

  • try to execute following

    mvn verify -Dcucumber.options="--tags not @ignore" 
    

    Or

    mvn verify -Dcucumber.options="--tags @runme"
    

    where @runme is a tag over Scenario or Feature.