Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 5 Next »

Purpose

Unit Test Coverage shows a percentage of a source code is covered by the unit tests. It is a mix of Line coverage and Condition coverage. The metric can be calculated also for a new code only.

How it works

Chart overview

Chart shows Unit Tests Coverage in % by month:

2017-10-23_15-56-43.png

In case if multiple Sonar projects are configured for a project in PERF, there is an option to view a summary over all them:



Calculation formula

Unit Test Coverage = (CT + CF + LC) / (2*B + EL),

where

  • CT = conditions that have been evaluated to 'true' at least once 
  • CF = conditions that have been evaluated to 'false' at least once
  • LC = covered lines = lines_to_cover - uncovered_lines
  • B = total number of conditions
  • EL = total number of executable lines (lines_to_cover)

RAG thresholds: Red <= 20%, Amber <= 50%.

Unit Test Coverage for a New Code, % claculation is Identical to Unit Test Coverage but restricted to new/updated source code.

Data Source

Data for the metric can be collected from Sonar.

How this metric helps

Unit Test Coverage may be a guide for indicating areas which are not tested. After that it is essential to understand the reason for code not covered to prevent development issues.


 

Unable to render {include} The included page could not be found.
Unable to render {include} The included page could not be found.



  • No labels