Telerik® JustMock™ by Progress

OpenCover is an open source code coverage tool for .NET 2 and above.

OpenCover is most commonly used to gather coverage data of code that is being exercised by unit testing (i.e. nunit, mstest etc.).

This article explaines how to integrate Telerik JustMock with OpenCover.

Configuration steps

  1. Start by registering the OpenCover profiler. Run cmd.exe as Administrator and execute the following lines:

    regsvr32 "c:\Program Files (x86)\OpenCover\x64\OpenCover.Profiler.dll"

    regsvr32 "c:\Program Files (x86)\OpenCover\x86\OpenCover.Profiler.dll"


    You may need to change the above paths if OpenCover is deployed somewhere else on your machine.

  2. Once the OpenCover.Profiler.dll is registered, you must link it with the JustMock profiler:

    Open Cover Link Profilers

    This is better described here.

  3. Furhter, you will need to set the JUSTMOCK_INSTANCE environment variable to "1". Do this by inserting the following line in the previously opened command prompt:


  4. Then collect the coverage data of your assemblies:

    For example:

    "C:\Program Files (x86)\OpenCover\OpenCover.Console.exe" -mergebyhash –target:"C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\MSTest.exe" -output:"coverage.xml" -targetargs:"/testcontainer:justmockTestproject1.dll"

  5. Continue by generating a coverage report (for example, using the ReportGenerator), and checking the test results. If everything is set up as described, your elevated JustMock tests must pass:

    Open Cover Test Results

See Also