NCover Documentation

How Do I Collect Data?

Getting Started With Basic Coverage

From Code Central, you can monitor any number of build servers and/or desktops remotely and administer a repository of all their coverage data. Code Central doesn't collect coverage data directly, that task is performed by Collector, which is installed on a local machine and then connected to your Code Central server.

The local Collector will gather the coverage data and statistics on your source code and send the results to Code Central.

This ability to gather data globally is key to understanding how to leverage the power of NCover. When setting up any project the first question you should ask is, What process do I want to cover? If NCover can find the executable or service that's exercising your code, it can collect coverage data.

Creating a Code Central Project

From the Home view of the Code Central, click Add New to open the "Create a New Project" window.

General Settings

From the "General Settings" tab, name the project and then use a regex or file path to specify the executable that will be covered on the local machine where the Collector is installed.

For example, the file path option would be "C:\dev\TestApp\TestApp.exe".

The regex option would be simply "TestApp.exe", or "testapp.exe", as the regex isn't case-sensitive.

When your project selections are complete, the projects will be automatically synced to connected instances of Collector and set to Enabled by default.

Pre-Coverage Filter

NCover can include or exclude attributes, assemblies, files, methods, and types at runtime by using regular expressions, as specified in NCover's Pre-Coverage Filter.

You can cover only the code you care about and shorten collection times by specifying what assemblies Collector should or shouldn't be watching.

Collector will gather coverage on any code loaded when the executable defined in the previous step runs, but you don't always want to collect coverage on everything -- Microsoft Active Accessibility code, for example.

  1. Click the to add a new filter.

  2. Create a Name

  3. Add a Description (optional).

Filter Rules have the following configurable parameters:

Include or Exclude

Type - Module, Namespace, Class, Method, Attribute, Document Path, Branch Coverage, Sequence Point Coverage, Max Complexity Percentage and Max Complexity.

Condition - Matches, Starts With, Ends With, Contains, and Regex.

Value

Using the example of the Microsoft Active Accessibility module we discussed earlier, a filter rule to exclude that code would look like this:

You can also create a filter to include only the code you care about, and ignore everything else, by specifying your assemblies with an include rule:

Thresholds

NCover reports coverage statistics with color coding based on the thresholds provided in these settings, which are set with some reasonable default values when you create a project.

You can reset these values at any time by clicking on Reset to defaults.

Collecting Coverage

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 the preconfigured project settings from Code Central.

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

If you still need technical assistance, we can help:

Submit A Support Ticket