Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Wiki Markup
{iframe:src=http://update.sonarsource.org/plugins/cobertura-confluence.html|width=700|height=350|frameborder=0}
{color:#333333}Your browser does not support iframes.{color}{iframe}

Description / Feature

Get code coverage for Java project with Cobertura. The plugin is based on the cobertura-maven-plugin and so can only be used to compute code coverage information on Maven projects.

...

It provides the ability to feed SonarQube with code coverage data coming from Cobertura.

Cobertura Plugin

1.1
1.21.31.41.51.6

Reports generated with Cobertura

1.9.4.1
cobertura-maven-plugin2.5.1
1.9.4.11.9.4.11.9.4.11.9.4.11.9.4.1

Installation

  1. Install the Cobertura plugin through the Update Center or download it into the SONARthe SONARQUBE_HOME/extensions/plugins directory from the Java Ecosystem  directory
  2. The default location of the XML Cobertura report is : target/site/cobertura/coverage.xml . You can change it in Configure in the Settings > General Settings > Java > Cobertura page
  3. Restart the Sonar SonarQube server

Usage

To launch Cobertura from Maven use this command: mvn cobertura:cobertura -Dcobertura.report.format=xml

For more on Cobertura, see its site.

See Code Coverage by Unit Tests for Java Project tutorial.

Note

In case the cobertura-maven-plugin is defined in the pom.xml of your project, Sonar will use the version defined in the pom and can potentially not function properly.