Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

First Experiment a success.

An excellent method for generating coverage reports is part of the maven 2 build. If you instrument the code for coverage and then run surefire reports the Junit tests are run and then an actual report of coverage can be automatically generated.

First results were negative. Adding the right information to the top level pom generated the correct tests, but  sadly alsogenerated the reports with zero length. Conclusion: Either I failed to add the correct information or this is an unwanted bug. However, going down to the modules the report generation succeeded.

Example.

Add at the end of a pom.xml before the last closing tag. 

...

Example.

Add at the end of the top level pom.xml there is a section for reoprting, expand as shown next 

No Format


<reporting>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-javadoc-plugin</artifactId>
        <configuration>
          <aggregate>true</aggregate>
        </configuration>
      </plugin>
    <plugin>
        <groupId>org.codehaus.mojo</groupId>
       
        <artifactId>cobertura-maven-plugin</artifactId>
        <configuration>     <configuration>     
         <formats>
               
                <format>xml</format>
               
                <format>html</format>
       
        </formats>
        </configuration>
 </plugin>
 </plugins> </reporting>plugin>
  <pluginRepositories>         <pluginRepository>                 <id>Codehaus Snapshots</id>
                <url>http://snapshots.repository.codehaus.org/</url>
        </pluginRepository>
</pluginRepositories>

...

</plugins>
  </reporting>
 



Next run mvn cobertura:cobertura.

Under the directory directories target/site is the beginning of the report.

Brut force but functional 

Some relatively straight foward Perl code can perform the following workflow:

...

.

 Screenshot