Getting code coverage for manual testing (or anything really)

This question crops up from time to time, and it was suggested that I just post this to my blog, since it seems it's rare enough that people have a hard time finding it :-)

 

The only reason I even have it is because an old lab that we had at Notion actually had students implement this. The following describes how to get code coverage on .NET applications without having to actually run "tests" in the VSTS context. You will need either Team Dev or Team Test installed to have the right tools to make this work.

 

Using the commandline you can instrument ANY .NET assembly (code signing can cause problems). Once that code is instrumtented, you need to actual get the "listener" running to collect the code coverage data this generated. Here's the basic steps:

 

First, you have to open a VS command prompt:

 

a.       Instrument your assembly by executing:

vsinstr /coverage Assemblyname.dll

 

b.       Start the Code Coverage monitoring process by executing:

vsperfcmd /start:coverage /output:yourfilename.coverage

 

Run your Application that contains the instrumented code

 

End the Code Coverage monitoring process by executing:

 

vsperfcmd /shutdown

 

You should then have a file with a "yourfilename.coverage" file in the application directory that you can open up in Visual Studio to view the results.

 

Comments

# Come ottenere il Code Coverage senza lanciare i Test da Visual Studio

Thursday, January 25, 2007 2:47 PM by Lorenzo Barbieri @ UGIblogs!

# The Disco Blog » Blog Archive » The weekly bag– Jan 26

# VSTS Links - 01/30/2007

Tuesday, January 30, 2007 8:17 AM by Team System News

Clara Oscura on Class Code Coverage in TFS Warehouse.

Jeff Beehler on Performance Testing Guidance...

# re: Getting code coverage for manual testing (or anything really)

Wednesday, February 07, 2007 10:28 AM by ascampanelli

Is there any way to put those manual code coverage results into the TFS warehouse?

# re: Getting code coverage for manual testing (or anything really)

Wednesday, February 07, 2007 10:28 AM by ascampanelli

Is there any way to put those manual code coverage results into the TFS warehouse?

# Cheat Codes » Getting code coverage for manual testing (or anything really)

# Code coverage for ie hosted user controls | keyongtech

Thursday, January 22, 2009 1:33 AM by Code coverage for ie hosted user controls | keyongtech

Pingback from  Code coverage for ie hosted user controls | keyongtech

Leave a Comment

(required) 
(required) 
(optional)
(required)