Enabling Code Coverage in VS2010

Enabling Code Coverage for the first time in Visual Studio 2010 isn’t obvious, once unit tests are completed and running the following steps are required.

  1. Select the testsettings file in Solution Items and open it.
  2. Select Data and Diagnostics
  3. Select Code Coverage and check the Enabled check box

This enables a ‘Configure’ button, this is the bit that isn’t obvious, using the Configure button you need to select the ‘artifacts to instrument’,  without this Code Coverage will be configured to run but no code will be checked.

As shown below.

Once that is done running the unit tests again will also perform code coverage.

Advertisements

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 )

Twitter picture

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

Facebook photo

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

Google+ photo

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

Connecting to %s