NCover Documentation

Covering Your Build Server

From Code Central, you can monitor any number of build servers and/or desktops remotely and view all their coverage data. Code Central can collect coverage data locally if installed on the build server, or remotely using Collector.

A Collector installed on the build server and connected to Code Central will gather coverage data every time your tests run and automatically send the results to Code Central.

The key to profiling any build with NCover is in profiling the right process.

If you're running MSTest in your Sonar build, then you set up an NCover project to monitor qtagent. If you're running NUnit, you set up a project to monitor nunit-agent.

So, the build platform isn't as important as the process that's running your unit tests.

Creating a Code Central Project

The first step is to create an NCover project where coverage results will be sent and displayed in the NCover GUI.

From the Home view of the Code Central, click Add New to open the "Create a New Project" window and give your new project a name.

Next, tell NCover what processes you want to profile, using either Auto-Configure or Edit Match Rules.

Edit Match Rules

If you're setting up coverage for a process running locally on the machine where Code Central is installed, you can let Auto-Configure (see next heading below) create project settings for you.

If you're setting up a project for a remote Collector, then keep following these steps.

From the "Processes" tab, click on Edit Match Rules to specify the test runner you want to monitor.

The Match type options are Regex and Exe.

Let's say you want to monitor NUnit tests. Regex is a good choice in this case. The Regex option would be simply "nunit-agent", since the regex isn't case-sensitive. This regex pattern would match "nunit-agent.exe","nunit-agent-x86.exe," etc.

The Exe option tells the NCover profiler to match on the executable name.

You can also use a complete file path if you want to profile a process only when it runs from a specific location.


The second option for defining process(es) to cover is to click on the Auto-Configure button and let NCover create match rules for you.

The Processes tab will switch to the Auto-Detection view and start monitoring for .NET processes as soon as you click on Auto-Configure.

Start the test runner, and the executables and assemblies that are being loaded during your testing will display in the detection window.

Switch the Pre-Coverage filter radio button to "Create filter" to review the "Modules to cover" and decide whether to include or exclude modules from the list.

Review the list and uncheck any items that shouldn't be covered. For example, you may want to include the nunit-agent.exe., but not the nunit.exe (the GUI).

Click the checkbox beside each module once to mark with an X to exclude the module. Click twice to mark with a check to include the module.

Note: You can specifically exclude modules by placing an X beside them on this screen, but any modules that are not specifically included will not be profiled, anyway. In other words, not creating an include is functionally the same as creating an exclude rule.

The selections shown above create the filter rules seen below when you click on the Filters tab.

Go the "Processes" tab and click Save to accept these selections, or Re-detect processes to start over.

Collecting Coverage Locally

When your project selections are completed, re-start your test runner and run your unit tests to collect coverage.

Go to the Home page and you'll see that the light beside your enabled project is pulsing green to indicate coverage is being collected.

Immediately to the right of your project name, the Modules Collecting counter displays the number of modules being profiled in the current execution of your project.

When your NUnit tests are complete, close your test runner to stop profiling and allow NCover to collect coverage data. When the data is aggregated, the results will be automatically displayed below your project on the Home view.

Collecting Coverage Remotely

Once you've installed a Collector on your build server to profile your tests, connect it to Code Central and it will automatically pull down project settings from Code Central.

The NCover Run Command

Since it's likely that you have more than one project on your build server that uses NUnit (or MSTest, or Gallio, etc.), having a Code Central project set up to simply monitor the nunit-agent would gather coverage data each time NUnit runs.

The Run command allows NCover to:

  • Collect data from the covered process.
  • Send the coverage results to the project you specify (the one you created above).
  • Summarize the coverage results and generate links to the Coverage Summary report.

Read more about the Run command in the feature reference and on the NCover blog at

Using the Run Command

The first part of the NCover Run command is the NCover project and (optional) build ID and working directory, the second half is the arguments for the covered application.

NCover Run can cover any .NET test runner, but the most common scenarios are profiling MSTest and NUnit.

Coverage Summary Report

When NCover Run executes successfully, coverage will be collected on NUnit and displayed in your project in the Desktop GUI. The collection summary and report links will also be displayed in the command line output.

  • Copy the link to the Coverage Summary report from the command line output, which will look like this: Link to summary report:

  • Paste the link into your browser and the Coverage Summary report will display (there's more helpful info in this blog post:

When generating this report from Desktop please note that, unlike Code Central, Desktop does not serve external pages. This means that reports generated from Desktop can only be viewed locally, on the Desktop machine.

  • Once NCover Run is working as expected, add it to your build script (usually as an ) and test again.

The next time the covered process you've defined in the Code Central project is run on a QA machine or a build server, Collector will automatically gather coverage and send it to Code Central, where you can view and analyze the coverage results.

If you still need technical assistance, we can help:

Submit A Support Ticket