Generating unit tests – HTML reports

In the preceding section, we ran the unit tests, and the results were generated in the txt and xml format. Often, developers need to generate more readable reports. Also, as a matter of fact, the reports should be a part of site documentation for better collaboration and information available in one place. To generate an HTML report and make it a part of site documentation, add the dependency under the reporting element as plugin in the pom file as follows:

<reporting>
    <plugins>
…...
<!-- For HTML test report generation -->
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-surefire-report-plugin</artifactId>
        <version>2.17</version>
      </plugin>
…...
    </plugins>
</reporting>

After the addition shown in the preceding code, run the site phase from the previous section. The test reports would be available by navigating to Project Documentation | Project Reports | Surefire Report of the navigation in index.html, as shown in the following screenshot:

Generating unit tests – HTML reports
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.14.245.167