Skip to content

LinuxSuRen/code-coverage-api-plugin

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

code-coverage-api-plugin

Build Status Gitter

This plugin serves as API to integrate and publish multiple coverage report types. More information see https://jenkins.io/projects/gsoc/2018/code-coverage-api-plugin/.

Features

  • Pipeline support
  • Modernized coverage chart
  • Coverage trend support
  • Multi-report aggregated
  • Rest API
  • Auto detect report
  • Easy to implement

Supported Tools

Embedded tools

Other plugins as an Extension of Code Coverage API plugin

Release Notes

See the CHANGELOG.

How to use it

1. Config coverage tool to generate reports.

Config maven to generate Cobertura coverage reports:

<build>
    <plugins>
        <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>cobertura-maven-plugin</artifactId>
            <version>2.7</version>
            <configuration>
                <formats>
                    <format>xml</format>
                </formats>
                <check/>
            </configuration>
            <executions>
                <execution>
                    <phase>package</phase>
                    <goals>
                        <goal>cobertura</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>
    </plugins>
</build>

More information about Cobertura.

Config maven to generate Jacoco coverage reports:

<build>
    <plugins>
        <plugin>
            <groupId>org.jacoco</groupId>
            <artifactId>jacoco-maven-plugin</artifactId>
            <version>0.8.1</version>
            <executions>
                <execution>
                    <goals>
                        <goal>prepare-agent</goal>
                    </goals>
                </execution>
                <execution>
                    <id>report</id>
                    <phase>package</phase>
                    <goals>
                        <goal>report</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>
    </plugins>
</build>

More Information about Jacoco.

Use llvm-cov to generate JSON format report:

$ llvm-cov export -instr-profile /path/to/foo.profdata /path/to/foo

More Information llvm-cov.

2. Install Jenkins plugins which implement Code Coverage API plugin (cobertura-plugin, llvm-cov-plugin).
3. Enable "Publish Coverage Report" publisher in the Post-build Actions.
4. Add your coverage tool adapter and specify reports path.

alt text

5. (Optional) Specify Thresholds of each metrics in global or adapter level.
6. (Optional) Specify Source code storing level to enable source code navigation.

alt text

About

Jenkins Code Coverage API Plugin

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Java 86.6%
  • JavaScript 7.7%
  • XSLT 5.1%
  • CSS 0.6%