How to enable code coverage in Visual Studio 2010 ?
By | September 8, 2011

This Tips explains how  we can enable code coverage in Visual Studio for specific assembly during unit test run.  Enabling this setting will help to view the covered code block on every run of unit test.

The steps to enable code coverage in Visual Studio 2010 are

1. Open the testsettings as displayed below

image5 thumb How to enable code coverage in Visual Studio 2010 ?

2. Enable code coverage as displayed below

image10 How to enable code coverage in Visual Studio 2010 ?

3. Double click the Code Coverage row. Select the artifacts to instrument. Specify the strong name key file path if artifacts are signed.

image15 How to enable code coverage in Visual Studio 2010 ?

4. Run unit tests. Open the code coverage results as displayed below

image19 How to enable code coverage in Visual Studio 2010 ?

image4 How to enable code coverage in Visual Studio 2010 ?

Category: TFS Tips Visual Studio Tags: , , ,

About The Author

Atul Verma

I am working at Microsoft as a .NET Consultant. I have an experience of 5 years in .NET technologies and application packaging. My expertise include .NET Framework(4.0, 3.5, 3.0, 2.0), WPF, WCF, ASP.net, AJAX, Web Services, Enterprise Library, Enterprise Applications, SharePoint 2010, Web Services, SQL Server (2008, 2005), Open Xml, MS Word Automation.