Skip to content

Code Coverage in VSTS 2005

by Alex Peck on February 6th, 2009

I’m measuring test code coverage on an application stack with both .NET (managed) and native (unmanaged) components. For some reason the help doesn’t explicitly state how this is accomplished, and some googling suggested that you need to go outside the IDE to instrument the native code.

This isn’t the case. With a Visual Studio 2005 solution consisting of:

  • a native .dll project
  • a .NET .dll project
  • an mstest project

Instrumentation can be enabled by editing the localtestrun.testrunconfig solution item. Look for the code coverage section and select the artifacts you want to instrument.

Caveat: the native binary will not be instrumented unless it is linked with the /PROFILE switch. There is no error message if you forget, it just silently fails to collect coverage for the .dll.

No comments yet

Leave a Reply

Note: XHTML is allowed. Your email address will never be published.

Subscribe to this comment feed via RSS