

The coverage monitor is called VsPerfMon.exe and is located in the same location as VsInstr.exe was located. The next step in collecting code coverage information is to make sure that the collection monitor is running so that our collected coverage data gets written somewhere. When you instrument the assembly you are modifying it permanently, so the VsInstr tool automatically makes a backup of the file you instrument. Instrumenting the assembly is done by passing the –coverage option to the VsInstr.exe tool: Microsoft Visual Studio 8\Team Tools\Performance Tools The tool that you use to instrument is called VsInstr.exe and it is found in the following directory You can instrument both managed and native dll files, exe files and assemblies. Instrumentation will insert code into the assemblies so that when they are run, code coverage information will be collected. The first main step to collecting code coverage information is to instrument the assemblies that you are interested it.

Vsperfcmd /start:coverage /output:”Path\Of\de-coverage”Ĥ) Run your tests which are testing the functionality of “ Path\To\You\TestedAssembly.dll“ĥ) Stop the coverage monitor by running the command

Vsinstr /coverage “Path\To\You\TestedAssembly.dll”ģ) Start coverage monitor by running the command %ProgramFiles%\Microsoft Visual Studio 10.0\Team Tools\Performance Tools. Here’s how to do itġ) Launch VS command prompt or change to the VS location which contains the tools, e.g. For me, running testing related tasks in the IDE is very slow, especially if you are working in a big project. For efficiency & quickness, I prefer to run unit test & get the code coverage from the command line – this helps me spare the Visual Studio IDE to do other tasks.
