Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can Microsoft code coverage tool generate XML file as a report format?

The Microsoft code coverage tool (vsinstr.exe) generates a binary file to be read in Visual Studio. Can it also generate an XML file?

like image 625
prosseek Avatar asked Dec 29 '22 01:12

prosseek


2 Answers

Minor correction: vsinstr.exe is the tool used to instrument a binary for code coverage (or profiling). VSPerfMon.exe is the code coverage monitor that actually writes the binary .coverage file to disk.

Inside the IDE, in the "Code Coverage Results" tool window, you can click "Export Results" to export the coverage data in an XML format:

Code coverage XML export.

VS2010 does not have a command-line utility to dump .coverage files to XML, however, you can use the code coverage API to do this yourself. See this blog post (and Peter's blog in general) and the CoverageDS.ExportXml function for doing so.

The coverage XML file has summary data that's similar to what you see in the VS UI. If you need more specific coverage details (e.g. per-block coverage information), you can use the code coverage API to get it.

like image 193
Chris Schmich Avatar answered Dec 30 '22 14:12

Chris Schmich


You can also generate XML from command line using this:
http://blogs.msdn.com/b/ms_joc/archive/2005/04/08/406608.aspx

like image 23
Uri Cohen Avatar answered Dec 30 '22 14:12

Uri Cohen