Code coverage is one of the benchmark strategy for any commercial or opensource product.
Cobertura is one of the best tool to generates code coverage percentage.
It can be configured both ant and maven build. In maven goal is "cobertura:cobertura"
refer here other goals.
[INFO] Cobertura Report generation was successful.
You can see in the logs code coverage generation is success but you will
not see any report or coverage.xml in the work space. To generate
coverage.xml, need to add below plugin in the pom file.
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>cobertura-maven-plugin</artifactId>
<version>2.2</version>
<configuration>
<formats>
<format>xml</format>
</formats>
</configuration>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>cobertura</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
This would work better if we have only one module, but if application having multi-module (api, services, web etc)
consolidated report generation having an issue still open at the time of writing.
Below is the error you would get if you have multiple module application.
Skipping Cobertura coverage report as build was not UNSTABLE or better ...
cobertura multi-module coverage
No comments:
Post a Comment