Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

maven surefire reporting plugin configuration

I have a multi-module maven project. The parent pom.xml is simply a way to reference common information for the 4 subprojects. I have quite a few JUnit tests that run and I also have the Parent Project set up for Project WebSite using the maven-info-reports-plugin.

I have the maven-surefire-report-plugin configured in the parent and it generates the target/site/surefire-report.html file in each of the subprojects with the correct information.

My problem is when I run my project website via site:run I do not see any of the surefire-report.html files in the Project website. The one that shows is in the target directory of the parent and it has no unit tests defined.

Is there a way I can configure maven-surefire-report-plugin or maven-info-reports-plugin to aggregate the subprojects generated surefire reports?

like image 225
Peter Delaney Avatar asked Aug 13 '09 20:08

Peter Delaney


People also ask

What is Maven surefire report plugin?

The Surefire Report Plugin parses the generated TEST-*. xml files under ${basedir}/target/surefire-reports and renders them using DOXIA, which creates the web interface version of the test results. Roadmap. Release Targets.

How do I disable surefire report in Maven?

skipSurefireReport: If set to true the surefire report generation will be skipped. https://maven.apache.org/surefire/maven-surefire-report-plugin/report-mojo.html#skipSurefireReport. this code will skip the surefire tests.

Which command is used for generating unit test reports Maven surefire report report Maven surefire report report Maven surefire report Mvn surefire report?

The Maven unit test reports are generated by the Maven Surefire plugin. Therefore a unit test report is also some times referred to as surefire report.


2 Answers

To elaborate on Seph's answer. You can set many of the Maven reports to aggregate results. To do this with the surefire-report plugin you'd do something like this:

<reporting>
  <plugins>
    <plugin>
      <groupId>org.apache.maven.plugins</groupId>
      <artifactId>maven-surefire-report-plugin</artifactId>
      <version>2.4.2</version>
      <configuration>
        <aggregate>true</aggregate>
        <!--also set this to link to generated source reports-->
        <linkXRef>true</linkXRef>
      </configuration>
    </plugin>
  </plugins>
</reporting>

Note the additional linkXRef property, this allows you to add cross-references to the generated html version of the source produced by the jxr plugin. The jxr plugin can also be set to aggregate, so the two combined allow you to browse your entire project structure.

As far as I know, the maven-info-reports-plugin doesn't do aggregation.

like image 71
Rich Seller Avatar answered Oct 10 '22 18:10

Rich Seller


You can add

<aggregate>true</aggregate>

to the surefire plugin in the parent pom.xml.

like image 44
Seph Avatar answered Oct 10 '22 17:10

Seph