views:

226

answers:

2

Say I have Test assembly (NUnit compliant) App.Test.dll and a library to be tested App.dll.

How do I get the code coverage analysis using PartCover and NUint?

+1  A: 

The easiest way is to set up an NUnit test project (which runs App.Test.dll), then from PartCover call the NUnit console runner and pass the project name as a parameter. I have a blog post about it if you want to check that out.

(I haven't tried with .Net 4 or the latest versions of NUnit/PartCover but I'm assuming it's still the same).

Grant Crofton
+2  A: 

I concur. In my experiments (see blog post here: http://www.csharpcity.com/using-partcover-and-nunit-for-code-coverage/) I set up a project with an NUnit-complaint "AutomatedTest" project (which referenced NUnit's framework DLL and outputted a DLL full of test classes), and ran that through PartCover.

ashes999
I had a problem when I specified +[*]namespace* as the rule. +[Namespace]* works though
Louis Rhys
That's strange. The partcover doc swears that between square brackets is the project namespace. I start with +[*]* and then use whatever appears in the report :)
ashes999
hmm when I tried +[*]* it reported the code coverage of nunit.. is there something I did wrong here?
Louis Rhys
I think you've already found my other thread on this. Yes, there seems to be a bug in PartCover.
ashes999