NCover 4 Desktop: First Coverage Project

When I start any NC4 project, the first question I ask is, What process do I want to cover? If NCover 4 Desktop can find the executable or service that’s exercising my code, it can collect coverage data.

1. Creating a Project
From the Home view of the NCover Desktop, I click

2. Settings
When the “General Settings” tab displays, I name my project and then use an Exe file name/path or Regex to specify one or more processes to be covered.

 

For example, the file path option would be “C:\Program Files\NCover\Samples\WPFApplication\bin\Debug\SampleWPFApp.exe”.

The regex option would be simply “SampleWPFApp.exe”, or “samplewpfapp.exe” — the regex pattern here isn’t case-sensitive.

 

3. Auto-Configure
Another very handy option is to click on the Auto-Configure button and let NCover create match rules for me.

 

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

 

When I start my application, the executables and assemblies that are being loaded will display in the detection window in an expanded tree view.

 

If the process I want to profile is already running, I have to re-start it in order for NCover to detect.

Then, I review the list of detected assemblies, and I can uncheck any items that shouldn’t be covered.

Notice that Desktop automatically unchecks some common code, such as the Microsoft Accessibility.dll, but I can always select the checkbox if i want to cover it.

 

I click on Stop Detection when my selections are complete, and Restart Detection, if necessary, to re-capture my  processes/assemblies.

When I’m satisfied with the results of the auto-detect, I can click on Show Match Rules to view the processes I selected. This takes me back to the General Settings tab, where the results of the auto-detect have been used to automatically create a match rule for my executable.

 

If I have already saved project settings, a pop-up will alert me that confirming the configuration will reset the Match Rules and Pre-Coverage filter conditions, but these changes are not automatically saved. I still have to press Save to commit the changes for this project.

 

I can click on Save to accept these selections, or I can click on the General Settings tab again to start over.

 

NOTE: “Include” filters will be automatically created based on the detected modules that you selected. I can review, modify, or delete the filters on the “Pre-Coverage Filter” tab.

 

4. Collect Coverage
When your project selections are complete, re-start your application and then run the manual tests on your profiled application.

Go to the Desktop 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. The number will fluctuate while coverage is running, but the counter should disappear when profiling is complete.

When testing is complete, close your tested application and NCover will automatically start compiling the coverage data.