Enabling Code Coverage in VS 2010 Beta 2

A quick “how-to” as the steps to enable code coverage are different in Beta 2. To enable code coverage (assuming that you have some unit tests defined already and that you have either Visual Studio 2010 Beta 2 Premium or Ulitmate):

  • Open the Solution Explorer.
  • Open the Solution Items folder
  • Double-click the Local.testsettings file:

image

  • Select the Data and Diagnostics option in the left hand list:

image

  • Select Code Coverage and make sure that it is enabled AND (and here’s the obvious but easy to overlook bit) click on the Configure option at the top of the table:

image

  • Select the artifacts that you want to enable code coverage for (in my case only the application code, not the tests themselves).
  • Click OK, Apply the changes, run the Unit tests and view the code coverage results:

image

And that’s it – hopefully that might help avoid a couple of minutes of wondering where the configuration settings can be found.

Cheers,

Giles