Track code coverage in pipeline runs
This topic explains how to see combined data from your Jenkins JaCoCo or LCOV code coverage reports in ALM Octane.
To enable frequent releases with minimal disruption and maximum quality, it is best to regularly run automated tests that cover as much of your code as possible. Code coverage on pipeline runs measures the percentage of lines in your code that was called during a particular run of the pipeline.
ALM Octane combines the information from all of the code coverage reports in your pipeline run and shows you a unified picture. Pipelines display widgets that show code coverage per package and per file, as well as code coverage trends over time. Using this information, you can track how much of your code is covered by automated tests.
Tracking code coverage in ALM Octane is made up of the following:
Configure code coverage reports on Jenkins
Standard industry tools
|Send code coverage reports to ALM Octane||
Jenkins Application Automation Tools plugin
|View code coverage information||
Connecting ALM Octane to code coverage data from Jenkins requires the following:
Use standard industry tools such as Maven and JaCoCo to generate code coverage JaCoCo or LCOV reports on your Jenkins server.
Set up ALM Octane integration with your Jenkins server using the Application Automation Tools plugin. For details, see Set up CI servers.
This feature requires version 5.3.1 or later of the plugin . This version is currently available as a beta version. If you are using an earlier version of the plugin, you can upgrade your plugin to this version.
In Jenkins, for pipeline steps whose code coverage you want to track on ALM Octane, create a post-build step that sends the code coverage reports to ALM Octane.
Select the HPE ALM Octane code coverage publisher post-build step, and provide the paths to your code coverage reports.
Run the pipeline.
ALM Octane receives all of the code coverage reports that belong to one pipeline run and aggregates them. You can then see an overall picture of the code coverage in your pipeline runs and determine whether the coverage is improving over time.
In the Pipelines > Pipelines page, add the code coverage widgets to the pipeline dashboard. The widgets show code coverage per package and per file, as well as code coverage trends over time.
The Code coverage by pipeline run widget shows the overall percentage of code lines covered by automated tests in each pipeline run. Invest in developing automated tests for as much of your code as possible, aiming to develop and then maintain a high code coverage as your code base grows.
The Code coverage by package widget shows the code coverage per package in your code base, as well as the percentage of code lines covered by automated tests in each file. For more details, see The 'Code coverage by package' widget.
Tip: Use the widget configuration's Scope settings to define which package to view as the root of the chart. For example, a team leader might want to focus on the package that is relevant to their team rather than viewing the full product hierarchy.
Click the pipeline's ID to open it.
In the Runs tab, you can see a code coverage bar on each pipeline run. Red represents the code lines that were not reached by any test runs. Green represents the code lines that were called at least once during the tests that ran as part of this pipeline run. Hover over the bar to see the exact numbers of files.
Use the Code coverage by package widget to quickly identify the largest areas in your code and the ones with the lowest code coverage. If important code packages are large and have low coverage, invest in creating more or better automated tests for those areas.
This widget is interactive and shows more information about the areas you hover over or click.
Each area in this sunburst chart represents a code package.
The size of each area indicates the amount of code lines in the package.
The color of the area represents the code coverage of this package. Red represents packages where no code lines were reached by any test runs. Green represents 100% code coverage. The colors and shades in between represent the range of code coverage percentage.
The circles represent the code package hierarchy, with the high-level packages closer to the center of the chart.
Hover over an area to see the package name and the code coverage percentage.
The outer rim of the chart represents code packages at the bottom of the hierarchy, which contain files. Click on areas in the outer rim to open a heatmap that shows coverage details per file.
Each area in the heatmap represents a file in the selected package.
- The size of an area indicates the amount of code lines in the file.
- The color of the area represents the level of code coverage.
- Hover over an area to see the exact number of lines and code coverage percentage.