New to Telerik JustMock? Download free 30-day trial


NCover Desktop is a .NET code coverage tool.

This article explains how to link the Telerik® JustMock and NCover profilers and have passing unit tests with collected code coverage.

Configuring NCover

You must install NCover with global profiling turned off. Otherwise, you will not be able to integrate it with the TelerikJustMock profiler.__

For more details, follow this link:

Linking JustMock and NCover Profilers

To use NCover along with the JustMock profiler, you will need to:

  1. Configure your NCover project:

    • MSTest (this points to an article from the NCover web site)
    • NUnit (this points to an article from the NCover web site)
  2. Register the NCover profiler.

    Run an elevated Command Prompt (cmd.exe as administrator). Navigate to the NCover install folder(by default: C:\Program Files\NCover v4 Desktop\) and execute the following line:

    ncover use --reg

  3. Link the profilers (depending on the NCover version you are using) from the JustMock Configuration tool:

    NCover Link Profilers

    This process is better described here.

  4. Set the JUSTMOCK_INSTANCE environment variable to "1".

    Do this by inserting the following line in the previously opened command prompt:


  5. Then, you will be able to collect the coverage data of your assemblies.

    For example:

    ncover run --project=proj -- "c:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\MSTest.exe" /testcontainer:"C:\Program Files (x86)\Telerik\JustMock\Examples\CSExamples\JustMock.ElevatedExamples\bin\Debug\JustMock.ElevatedExamples.dll"

    JustMock elevated tests should pass now:

    NCover Test Results

  6. Finally, check if coverage has been collected for your assemblies.

    NCover Coverage Results


To successfully unlink both profilers, you will need to:

  1. Unlink both profilers, as shown here.
  2. Unregister the NCover profiler with executing the following line in the command prompt: ncover use --unreg

Visual Studio Integration

Having the profilers linked must be enough for using both JustMock and NCover inside Visual Studio:


See Also

In this article