Analyzing Code Coverage in Build Verification Tests
Code coverage analysis in Microsoft Visual Studio shows you how much of your code is being exercised by automated tests. For more information, see Using Code Coverage to Determine How Much Code is being Tested.
When you check in your code, your tests will run on the build server, along with all the other tests from other team members. (If you haven’t already set this up, see Run Tests in Your Build Process.) It’s useful to analyze code coverage on the build service, because that provides the most up-to-date and comprehensive picture of coverage in the whole project. It will also include automated system tests and other coded tests that you don’t usually run on the development machines.
In Team Explorer, open Builds, and then add or edit a build definition.
On the Process page, expand Automated Tests, Test Source, Run Settings. Set Type of Run Settings File to Code Coverage Enabled.
If you have more than one Test Source definition, repeat this step for each one.
But there is no field named Type of Run Settings File.
Under Automated Tests, select Test Assembly and choose the ellipsis button [...] at the end of the line. In the Add/Edit Test Run dialog box, under Test Runner, choose Visual Studio Test Runner.
After the build runs, the code coverage results appear in the build summary.