views:

450

answers:

4

I've got some unit tests, and got some code coverage data. Now, I'd like to be able to view that code coverage data outside of visual studio, say in a web browser. But, when I export the code coverage to an xml file, I can't do anything with it. Are there readers out there for this? Do I have to write an xml parser and then display it how I want it (seems like a waste since visual studio already does this.) Seems kinda silly to have to take a screenshot of my code coverage results as my "report" Suggestions?

A: 

I use NCover to do all my code coverage and you have the ability to export the results quite easily

AutomatedTester
+1  A: 

I'd suggest installing Jamie Cansdale's wonderful testing add-in TestDriven.NET then right click on your test project ... test with coverage and you can export NCover report as html.

http://testdriven.net

HTH,

Dan

Daniel Elliott
+1  A: 

I can't speak for the content of the exported XML, but I'd expect it contain your coverage data as a summary.

The usual thing to do with XML data like this if you want to see it in a web browser page is to convert it to HTML by writing and running a custom XSLT script. This will presumably get you HTML text and tables containing your data.

If you want to see the coverage data as decorations imposed on the source code, I think you have a much harder problem.

Ira Baxter
A: 

You can use NDepend and visualize code coverage results imported from NCover or Visual Studio coverage. You can also write and apply continuously cool rules like:

Code refactored recently should be 100% covered by test:

WARN IF Count > 0 IN SELECT METHODS WHERE CodeWasChanged AND PercentageCoverage < 100

Types tagged with the attribute MyNamespace.FullCoveredAttribute must be thoroughly covered by tests:

WARN IF Count > 0 IN SELECT TYPES WHERE HasAttribute "MyNamespace.FullCoveredAttribute" AND PercentageCoverage < 100

More documentation here:

http://www.ndepend.com/Coverage.aspx

Make the most of your test coverage data

Patrick Smacchia - NDepend dev