When you want to Enable code coverage in an Unit test run in Visual Studio 2010 you may find that the steps you need to take have changed.
In Visual Studio 2010 you need to take the following steps:

Open the Local.testsettings file and there you will see a set of items you can configure on the left hand of the dialog.

Here you need to select the “Execution Criteria” in the left list and then you can see at the bottom of the page the set of collectors that are enabled for a test run.

In this list you need to select the “Code Coverage” item and mark the enabled check box. In the 2008 ide you would direct see the assemblies that are part of the coverage gathering during the run. In the 2010 dialog you can select the assemblies by first clicking on the “Code Coverage” row in the collectors list and then clicking the “Advanced…” button. Then you will see the more familiar dialog again as shown below:


Here you need to pick the assembly that is under test and click “Ok”

Now when you run another unit test you will see code coverage is now enabled.
When you take  a further look into the set of collectors you might also see a set of new collectors that you have not seen before.


When you enable e.g. the video recorder, you will get an video capture of your computer while the test was running. While this is less interesting for a Unit test that has no UI interactions, this is very interesting when you create a new type of test called Code UI test that can run an previously recorded UI test and replay it on a test machine. You can see the channel 9 video that shows more about coded UI testing if you want some more information on that new feature.

What is interested to see is enabling e.g. the Test Impact collector, that enables the Test Impact feature. Once this collector has run, you can see in the Visual Studio IDE a list of suggested tests based on code changes you have made to your local source. This enables you to run a minimum set of tests to verify changes you have made to the codebase. this test impact analysis can even be used during the Team Builds run e.g. every night on a server, so you can have a lean and mean build that runs only impacted tests to verify regression on previous tests.

When you create a new Unit test in a solution you also might notice that there is a second “testsettings” file created called “TraceAndTestImpact.testsettings”. this file contains all the settings to run a set of unit tests with the correct settings that enable test impact analysis.