Configuration‎ > ‎

OpenCover Unit Test Coverage in Visual Studio

Per Wikipedia, "code coverage is a measure used to describe the degree to which the source code of a program is tested by a particular test suite. A program with high code coverage has been more thoroughly tested and has a lower chance of containing software bugs than a program with low code coverage."

While we will include code coverage tools in our continuous integration project, it can be useful to run code coverage often while developing unit tests.


There are two items that need to be installed:
  1. OpenCover MSI:
  2. OpenCover UI VisualStudio Extension:
After installing the Open Cover MSI:
  1. In VisualStudio, navigate to Tools->Extensions and Updates
  2. Select 'Online' from the left most menu, and then Search for 'OpenCover' in the right most menu.

  3. Install OpenCover UI.
  4. Restart.

Using OpenCover in Visual Studio

The documentation provided by the developer of OpenCover UI is excellent, and should be explored before proceeding further:

There is one problem that users will likely experience: the first time a user right clicks on a test package in the OpenCover Test Explorer, an error will throw and the framework will request the location of the OpenCover executable. 

Per the documention, the OpenCover UI extension expects the executable to be located in %localappdata%\Apps\OpenCover.

On my machine, this resolved to C:\Users\praath\AppData\Local\Apps\OpenCover.