Question

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?

Was it helpful?

Solution

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.

OTHER TIPS

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).

It took me a while to figure out how get the source code markings. I had to put a /noshadow flag in the "Working Arguments". /noshadow prevents NUnit to make shadow copies of the files and will allow PartCover to load source files in the browser.

Then just click "Views->View Coverage Detail" after the run.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top