Code coverage widget for Azure DevOps dashboards
Is our code coverage going up or down? The widget puts a pipeline's latest coverage on the team dashboard, with the change since the previous run and a trend against your target.
Coverage is buried in a pipeline run
Azure Pipelines shows code coverage on each run's Code Coverage tab. To see whether it is rising or falling you open runs one by one and compare numbers. The dashboard widget catalog that ships with Azure DevOps has test result widgets, but no code coverage widget, so the number the team agreed to watch is not on the team's dashboard.
What the widget shows
- The latest coverage of the pipeline you pick, with one decimal: line coverage, and branch coverage next to it when your coverage tool reports branches.
- The change since the previous run, in points, with how many lines were covered and added.
- A trend of the last 5 to 30 runs that published coverage, with your target as a dashed line.
- Colors by your target: green at or above it (80% by default), amber down to a minimum (60%), red below, always with words so it reads without color too.
- Links to the run and to its Code Coverage tab for the full report.
The larger sizes list every metric your tool reports, for JaCoCo lines, branches, instructions, methods, classes and complexity, each with its change. It works with Publish Code Coverage Results v2 (any format it takes, reporting lines), v1 with Cobertura or JaCoCo, and the Visual Studio Test and .NET tasks with coverage on.
Set it up in three steps
- Install Code Coverage Widget from the Visual Studio Marketplace into your organization. Make sure your pipeline publishes coverage, for example with the Publish Code Coverage Results task.
- Edit a dashboard and add Code Coverage from the widget catalog.
- In its settings, search for the pipeline, choose the branch and metric, set your target and minimum, and pick a size: 1x1, 2x1, 2x2 or 3x2.
What it replaces
The Code Coverage Widgets extension many teams used is unpublished, so new organizations cannot install it. Other coverage widgets exist on the Marketplace. This one reads Cobertura, JaCoCo and Visual Studio coverage, shows every metric your tool reports at the larger sizes, and, when there is nothing to show, says why: no completed runs on that branch, only failed runs, no coverage published, coverage still being processed, a deleted pipeline, or missing permissions.
Limits
- The pipeline has to publish code coverage. The widget reads the summary Azure DevOps keeps for each run; it does not run tests or collect coverage itself.
- Failed runs are left out unless you include them, because tests that stopped early make coverage drop. Canceled runs are always left out.
- Publish Code Coverage Results v2 reports lines only; for branches, use v1 with Cobertura or JaCoCo.
- Viewers need permission to view the pipeline's builds and its test runs.
Privacy
Code Coverage Widget reads your pipeline's runs and their coverage summaries to draw the widget, in your browser. It changes nothing and sends nothing outside your Azure DevOps. Like every free IK Lab extension, it runs in your browser, has no backend and sends nothing to IK Lab or anyone else. The details are in the privacy policy.
Install Code Coverage Widget
Free on the Visual Studio Marketplace, with no sign-up, for Azure DevOps Services and Azure DevOps Server 2020 and later.