Satyajit Sahoo
Satyajit Sahoo

Reputation: 31

Cucumber project build success but console Test run 0, Test skip 0

While running cucumber project with junit with command prompt using command mvn install . Build showing success but showing Test Run 0, Test Executed 0,Test skip 0, Report showing perfectly, Automation work properly, but only issue in console showing 0. What could be issue?

Upvotes: 3

Views: 2244

Answers (1)

bv.
bv.

Reputation: 95

This message: [INFO] Tests run: 0, Failures: 0, Errors: 0, Skipped: 0 is produced via maven's surefire plugin. The issue happens when junit conflicts with TestNG. It can be not visible (especially when there is no explicit dependency in your POM-file), but if you run mvn -X test (produces execution debug output), you can find that surefire is actually preparing TestNG which fails to find any tests in this setup.

The solution would be to force maven to use surefire with junit(Manually Specifying a Provider):

pom.xml:

<plugins>
[...]
  <plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-surefire-plugin</artifactId>
    <version>3.0.0-M5</version>
    <dependencies>
      <dependency>
        <groupId>org.apache.maven.surefire</groupId>
        <artifactId>surefire-junit47</artifactId>
        <version>3.0.0-M5</version>
      </dependency>
    </dependencies>
  </plugin>
[...]
</plugins>

Making this change to POM and rebuilding the project finally picked up the right counts for the tests.

Upvotes: 5

Related Questions