I was wondering how to enable code-coverage for SharePoint 2010 automated unit test projects in Visual Studio 2010. Here are the steps :-
1. Double click on Local.testsettings
2. Go to Data and Diagnostics
3. Choose the list of assemblies to be instrumented
Locate the assembly file (.exe, .dll, or .ocx) that you want to include in code coverage and then click Open. The file is added to the list
4. If the source assemblies (to be instrumented) have a strong name, we need to re-sign those assemblies. Create a new key file that can be used for resigning assemblies. More details about the re-signing of assemblies can be found in this article .
Run the required unit tests for SharePoint code, now you will get an option to view code-coverage.
Pingback: Enabling Code Coverage for SharePoint 2010 Automated Unit Tests - My experiments with SharePoint, Azure and .NET using Visual Studio