SonarQube Generic Coverage Plugin

Imports coverage reports defined in the specified format. Coverage applied to files of any language.

License

License

GroupId

GroupId

org.codehaus.sonar-plugins
ArtifactId

ArtifactId

sonar-generic-coverage-plugin
Last Version

Last Version

1.1
Release Date

Release Date

Type

Type

sonar-plugin
Description

Description

SonarQube Generic Coverage Plugin
Imports coverage reports defined in the specified format. Coverage applied to files of any language.
Project Organization

Project Organization

SonarSource
Source Code Management

Source Code Management

https://github.com/SonarSource/sonar-generic-coverage

Download sonar-generic-coverage-plugin

Dependencies

provided (1)

Group / Artifact Type Version
org.codehaus.sonar : sonar-plugin-api jar 4.2

test (3)

Group / Artifact Type Version
org.codehaus.sonar : sonar-testing-harness jar 4.2
org.apache.maven : maven-project jar 2.2.0
org.mockito : mockito-all jar 1.9.5

Project Modules

There are no modules declared in this project.

Sonar Generic Coverage

Build Status

Deprecated since SonarQube 6.2 because the functionality was absorbed into SonarQube core.

Property Example Description
sonar.genericcoverage.reportPaths report1.xml, report2.xml Comma separated paths to the Coverage by UT Reports
sonar.genericcoverage.itReportPaths it_report.xml Comma separated paths to the Coverage by IT Reports
sonar.genericcoverage.unitTestReportPaths ut_report.xml Comma separated paths to the Unit Tests Execution Results Report

Unit Tests Execution Results Report Format

The project for which you want to import unit tests results should contain an XML file complying with the attached XSD schema. It should look like the following sample:

  <file path="src/test/java/com/example/MyTestClass.java">
    <testCase name="test1" duration="500"/>
    <testCase name="test2" duration="600"/>
    <testCase name="test3" duration="600">
      <failure message="sort message">long stacktrace</failure>
    </testCase>
    <testCase name="test4" duration="600">
      <error message="sort message">long stacktrace</error>
    </testCase>
    <testCase name="test5" duration="600">
      <skipped message="sort message">long stacktrace</skipped>
    </testCase>
  </file>
</unitTest>

The root node should be named "unitTest". Its version attribute should be set to "1". Insert a "file" element for each test file. Its "path" attribute can be either absolute or relative to the root of the module. (warning) Unlike for coverage reports, the files present in the report must be test file names, not source code files covered by tests. Inside a "file" element, insert a "testCase" for each test run by unit tests. It can have the following attributes/children:

  • "testCase" (mandatory)
  • "name" (mandatory): name of the test case
  • "duration (mandatory): long value in milliseconds
  • "failure|error|skipped" (optional): if the test is not ok report the cause with a message and a long description
  • "message" (mandatory): short message describing the cause
  • "stacktrace" (optional): long message containing details about "failure|error|skipped" status

Coverage by Unit Tests or Integration Tests Report Format

The project for which you want to import coverage data and integration tests coverage data should contain an XML file complying with the attached XSD schema. It should look like the following sample:

  <file path="src/main/java/com/example/MyClass.java">
    <lineToCover lineNumber="2" covered="false"/>
    <lineToCover lineNumber="3" covered="true" branchesToCover="8" coveredBranches="7"/>
  </file>
</coverage>

The root node should be named "coverage". Its version attribute should be set to "1". Insert a "file" element for each file which can be covered by tests. Its "path" attribute can be either absolute or relative to the root of the module. Inside a "file" element, insert a "lineToCover" for each line which can be covered by unit tests. It can have the following attributes:

  • "lineNumber" (mandatory)
  • "covered" (mandatory): boolean value indicating whether tests actually hit that line
  • "branchesToCover" (optional): number of branches which can be covered
  • "coveredBranches" (optional): number of branches which are actually covered by tests
org.codehaus.sonar-plugins

SonarSource

Continuous Code Quality

Versions

Version
1.1
1.0