GSoC 2018. Code Coverage API Plugin
Status: Completed
Overview
There are a lot of plugins which currently implement code coverage, however, they all use similar config, charts, and content. So it will be much better if we can have an API plugin which does the most repeated work for those plugins and offers a unified APIs which can be consumed by other plugins and external tools.
Supported Tools
-
Embedded tools
-
JaCoCo
-
-
Other plugins as an Extension of Code Coverage API plugin
-
Cobertura (Cobertura Plugin)
-
llvm-cov (llvm-cov Plugin)
-
Architecture
This API plugin will mainly do these things:
-
Find coverage reports according to the user’s config.
-
Use adapters to convert reports into the our standard format.
-
Parse standard format reports, and aggregate them.
-
Show parsed result in a chart.
So, we can implement code coverage publishing by simply writing an adapter, and such adapter only needs to do one thing - convert a coverage report into the standard format. The implementation is based on extension points, so new adapters can be created in separate plugins. In order to simplify conversion for XML reports, there is also an abstraction layer which allows creating XSLT-based converters.
architecture diagram
Features
-
Modernized coverage chart
-
Coverage trend
-
Source code navigation
-
Parallel pipeline support
-
Reports combining
-
Rest API
-
Failed conditions and flexible threshold setting
-
Other small features
You can see more details in our 1.0 release blog post
First Phase Summary
-
Prototype based on Cobertura plugin data model.
-
Integrate other Java code coverage tools.
-
Health report support.
-
Auto detect support.(JENKINS-51366)
-
Pipeline support.(JENKINS-51363)
-
Threshold support.(JENKINS-51364)
-
Modernize report.(JENKINS-51386)
-
Unit tests.(JENKINS-51611)
Second Phase Summary
-
Add source code navigation(JENKINS-51988)
-
Prototype integration between Code Coverage API and Cobertura plugin(JENKINS-51424)
-
Offer REST API to retrieve the coverage reports in machine-readable format.(JENKINS-51422)
-
Offer REST API to retrieve the coverage trends in machine-readable format.(JENKINS-51423)
-
Move auto-detector coverage publishing logic to the extension point implementation.(JENKINS-51737)
-
Refactoring the configuration page to make it more user-friendly.(JENKINS-51927)
-
Add support of llvm-cov Report converter.(JENKINS-51736)
Third Phase Summary
-
Supporting combining reports within a build(e.g. after parallel() execution in Pipeline). (JENKINS-51926)
-
Make Code Coverage API plugin more generic. (JENKINS-52839)
-
Migrate LLVM coverage out into new plugin (JENKINS-52630)
-
Refactoring of the adopted code(JENKINS-51733)
-
Change current REST API to the standard format.(JENKINS-52628)
-
Bug fixing.
-
Writing documentation.
-
Releasing the plugin.
Future tasks
-
Implement more coverage tools (JENKINS-52467, JENKINS-52469 and etc.)
-
Make the UI extensible (JENKINS-51738)
-
Improve performance (JENKINS-52982)