NCover Ignores C# 3.0 Automatic Properties

I’ve spent a good half hour trying to set up TestDriven.NET to analyse code coverage of my tests.
Here’s the scenario:

  • A new installation of VS 2008
  • A new installation of R# 4.0 (EAP build), TestDriven.NET 2.0 and xUnit 1.0 RC2
  • New solution with two projects project A (main project) and project B (xUnit unit tests)
  • Project A contains one class (MyClass) with three automatic properties
  • Project B contains one codefile with a test class testing automated properties of MyClass
  • I launch a test session with code coverage analysis
  • NCover Explorer shows absolutely no coverage for Project A

Puzzling. I immediately started googling to see if anyone else has had this problem and have gone through at least a dozen sites (including NCover FAQ page). Nothing. Not even close.

As a last resort, I’ve added an existing .cs file from another solution to Project A to see if that will trigger the coverage analysis to work correctly. And guess what – it did. Sort of.

Looking at the coverage results, it appears that C# automatic properties have no effect on the outcome of code coverage analysis – they are simply ignored.

Is this is a good thing or a bad thing? I haven’t decided.

Advertisements

1 comment so far

  1. Alan Johnson on

    Arnie,

    I’m a developer on the NCover team, and wanted to let you know that this is an issue that we know about and that we’re working hard to resolve. The issue arises because NCover uses debugging symbols to provide coverage data points, and we don’t get any debugging symbols back from automatic properties.

    One workaround is to use branch coverage, which is provided with our enterprise edition.

    I’m posting a bug to our bug tracking system to make certain that we post something about this in our FAQ. Please don’t hesitate to contact us via support@gnoso.com if you run into any other issues, or if you just have any suggestions on how to make using NCover better.

    Thanks for using NCover.

    Alan Johnson
    NCover Team


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: