Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

maven

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?

like image 588
Satyajit Sahoo Avatar asked Sep 20 '25 10:09

Satyajit Sahoo


1 Answers

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.

like image 198
bv. Avatar answered Sep 23 '25 12:09

bv.