Telerik® JustMock™ by Progress

NCover Desktop is a .NET code coverage tool.

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

Configuring NCover


Important step: You must install NCover with turned off global profiling! Otherwise, you will not be able to integrate it with the Telerik JustMock 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. Then, you will have to 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. Continue by linking 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. 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:


  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"

    Note, 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