views:

23

answers:

2

I haven't yet installed my license of NCover 3, and am still running 1.5.8 on my build server. I am trying to exclude full assemblies and specific classes that I don't want included in the report, because they are artificially lowering the coverage results.

In NCoverExplorer, I was playing around with the options because there is a coverage exclusions section in the Options tab where you can specify full namespaces. I've entered the fully qualified classes, and for some reason, only a handful of them get excluded, and I cannot figure out why. For example, when I add System.ComponentModel.Composition to the list, it never gets excluded!

Is this just a bug in 1.5.8 that I have to live with for now, since it is a beta and also no longer supported? Although I do have a new license for the server, I'd like to be able to do some coverage at home on my personal computer.

I found a really great article on using a CoverageExcludeAttribute to make NCover automatically skip those classes / methods that are marked with this attribute. Is this the best option?

+1  A: 

Did you try using regular expressions to include/exclude the assemblies -

//ias AuctionSniper([.\w]*?)(?<!Tests) includes all assemblies that begin with AuctionSniper but don't end with Tests e.g. AuctionSniper.Main.exe You can specify multiple patterns separated by semicolons.
or //ias .*vendorsupplied.*;.*tests

This works with NCover 3 - you can give it a try if it works for the free/community edition.

Gishu
I didn't... My understanding is that regex is only supported in NCover 2.0 and above. 1.5.x requires full assembly names. I did use wildcards with no success.
Dave
although it didn't address my problem with 1.5.8, I'm marking this as the answer because I got fed up with everything, upgraded to v3.4, and use the information here to get that installation going. :)
Dave
not one to get a chuckle from a fellow programmer's frustration with third party libs... but your comment just brought a 'been-there' knowing smile on my face.
Gishu
A: 

One way to get part way there is to also use the "assemblies to include in coverage" option. This allowed me to ignore System.ComponentModel.Composition. However, exlcuding most of the other classes and namespaces still doesn't work. It's a little odd how when I exclude an entire class, it only excludes the methods, but not any of the contained classes.

Dave