Code Coverage with PartCover

Code coverage is a static analysis technique to match your unit tests to your code and track how much of your code is being exercised by your testing suite. I had been using NCover (the paid version) for a while to identify areas of my code that needed more extensive testing. However, I’m on a small team, and every add-in necessary to get started is a barrier. A paid tool just wasn’t going to cut it. I looked into, but it is hopelessly outdated. After some more searching, I found partcover. This tool is open source and free. The syntax isn’t too hard to get used to. Run it once with just your test framework, and quickly start excluding assemblies and classes you aren’t interested in.

Once I figured out how to get the classes I want to show up in the reports, I ran into another problem. There are two xslt files to transform your xml results into a readable html file. Whenever I ran this, my results always came back 0%. I’ll admit, I’m no TDD guru, but my coverage isn’t that low. After some more digging, I found a patch to the two xslt files. Once this was applied, I was in business.

Leave a Reply

Name *
Email *