how to run a cucumber junit project from command line using verify

Viewed 40

I have an automation framework using cucumber and run as Junit test case. How can I run from command line using verify?

Right now I am right clicking on test runner class and run as junit test case.

I tried mvn test verify but it doesn't run the specific test runner class.

1 Answers

When using mvn verify Failsafe is used and test should be named accordingly:

https://maven.apache.org/surefire/maven-failsafe-plugin/examples/inclusion-exclusion.html Inclusions and Exclusions of Tests Inclusions

By default, the Failsafe Plugin will automatically include all test classes with the following wildcard patterns:

"**/IT*.java" - includes all of its subdirectories and all Java filenames that start with "IT".
"**/*IT.java" - includes all of its subdirectories and all Java filenames that end with "IT".
"**/*ITCase.java" - includes all of its subdirectories and all Java filenames that end with "ITCase".

If the test classes do not follow any of these naming conventions, then configure Failsafe Plugin and specify the tests you want to include.

When using mvn test Surefire is used and test should be named accordingly:

https://maven.apache.org/surefire/maven-surefire-plugin/examples/inclusion-exclusion.html Inclusions and Exclusions of Tests Inclusions

By default, the Surefire Plugin will automatically include all test classes with the following wildcard patterns:

"**/Test*.java" - includes all of its subdirectories and all Java filenames that start with "Test".
"**/*Test.java" - includes all of its subdirectories and all Java filenames that end with "Test".
"**/*Tests.java" - includes all of its subdirectories and all Java filenames that end with "Tests".
"**/*TestCase.java" - includes all of its subdirectories and all Java filenames that end with "TestCase".

If the test classes do not follow any of these naming conventions, then configure Surefire Plugin and specify the tests you want to include.

Related