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?

Tunaki
  • 132,869
  • 46
  • 340
  • 423
Dave
  • 14,618
  • 13
  • 91
  • 145
  • I guess you can still manually delete them from the tree before generating the report, but you want it to be automatic during profiling? – maxwellb Jun 29 '10 at 13:48
  • @maxwellb yes, automatic is what I am looking for. Although during profiling would be nice, I'm okay with post-processing with a script. I'll have to look at the TeamCity docs to see if I can actually modify coverage.xml before it's rendered to the screen. – Dave Jun 29 '10 at 14:19

2 Answers2

1

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
  • 134,492
  • 47
  • 225
  • 308
  • 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 Jun 29 '10 at 14:12
  • 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 Jul 06 '10 at 16:18
  • 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 Jul 06 '10 at 19:30
0

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
  • 14,618
  • 13
  • 91
  • 145