Skip to content
This repository has been archived by the owner on Nov 15, 2021. It is now read-only.

Code Coverage

Karel Zikmund edited this page Dec 18, 2017 · 7 revisions

"Testing shows the presence, not the absence of bugs" - Dijkstra

Code Coverage

There are many different coverage metrics and different coverage tool offerings have a tendency to cover overlapping metrics. A good analysis of different metrics can be found here for anyone interested in the subject.

The metrics that OpenCover was looking to address when it started were:

  1. Statement Coverage i.e. what lines have been covered.
  2. Method Coverage i.e. what methods have been covered.
  3. Branch Coverage i.e. which branches were taken. This is related to cyclometric complexity

Statement Coverage (Implemented)

OpenCover uses the PDB files to determine which lines of code are associated with each line of source code and then instruments each sequence point to record the hit.

Method Coverage (Implemented)

This is built into the sequence coverage points. Auto-implemented properties can be ignored.

Branch Coverage (Implemented)

OpenCover uses mono.Cecil to analyse the branches or IL to determine where to instrument the code.