Enabling Code Coverage for SharePoint 2010 Automated Unit Tests

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

image

2. Go to Data and Diagnostics

image

3. Choose the list of assemblies to be instrumented

image

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.

 Subscribe to my blog

One thought on “Enabling Code Coverage for SharePoint 2010 Automated Unit Tests

  1. Pingback: Enabling Code Coverage for SharePoint 2010 Automated Unit Tests - My experiments with SharePoint, Azure and .NET using Visual Studio

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.