Enabling Code Coverage in Visual Studio 2010

Posted by Stuart Preston on April 13, 2010 under Team Foundation Server | 4 Comments to Read

Hopefully this will save someone a minute or two.

In Visual Studio 2010 to enable Code Coverage, you edit the .TestSettings file (e.g. Local.TestSettings) – similar to the TestRunConfig file in Visual Studio 2008.  Code Coverage no longer has its own section – it can be found under Data and Diagnostics where you can then set Code Coverage to enabled by checking the box.

image

The subtle thing I missed for a couple of minutes was that the Configure button at the top of the grid only is enabled when you select the Code Coverage row – and in there is the Code Coverage Detail dialog that lets you select the “artifacts to instrument”.

Looks pretty obvious now huh!

  • VSTS Links – 04/14/2010 « Team System Rocks! said,

    [...] Stuart Preston on Enabling Code Coverage in Visual Studio 2010 [...]

  • Andrey said,

    Thanks, I was missing the button there as well. Not the best place for it to be.

  • roland said,

    Hi,

    Nice info

    I have a question:

    Just a test project:

    Local:
    ClassLibrary1.dll 1 25,00 % 3 75,00 %
    MyTestWebPage.dll 129 54,43 % 108 45,57 %

    on buildserver 2010:
    ClassLibrary1.dll 1 25,00 % 3 75,00 %

    Why does the buildserver not see the other project?

  • Stuart Preston said,

    Have you “enabled” deployment in your test settings, and are you selecting a specific assembly (.dll) rather than a website to instrument?

Add A Comment