'All maven surefire reports are zero! How could this happen?

I have a scala project configured with maven surefire plugin:

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-surefire-plugin</artifactId>
        <version>2.22.2</version>
      </plugin>

When I run all the tests and generates the test report, I found the following information on the index page:

Surefire Report
Summary

[Summary] [Package List] [Test Cases]

Tests   Errors  Failures    Skipped     Success Rate    Time
0   0   0   0   0%  0

It appears that all scalatest result under test-results/scalatest are ignored! How could this happen? This will never happen to gradle test report.



Solution 1:[1]

I just found out that scalatest was not designed to work with either maven-surefire-plugin or maven-surefire-report-plugin, it has to generate its own test report in html format:

      <plugin>
        <groupId>org.scalatest</groupId>
        <artifactId>scalatest-maven-plugin</artifactId>
        <version>2.0.2</version>
        <configuration>
          <reportsDirectory>${project.build.directory}/test-results/scalatest</reportsDirectory>
          <junitxml>.</junitxml>
          <htmlreporters>${project.build.directory}/site/scalatest</htmlreporters>

...

case closed.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 tribbloid