The Results of a Test Run can be obtained by using TFS 2010 API

You first need to add a reference to Microsoft.TeamFoundation.Client.dll and Microsoft.TeamFoundation.TestManagement.Client.dll

These dll can be found under C:\Program Files\Microsoft Visual Studio 10.0\Common7\IDE\PrivateAssemblies

The below code describes how to obtain Failed test cases of a Test Run

TfsTeamProjectCollection tfs = new TfsTeamProjectCollection(new Uri(http://%3cserver%3e:8080/tfs/%3Ccollection%3E));

ITestManagementService testManagement = (ITestManagementService)tfs.GetService(typeof(ITestManagementService));

ITestManagementTeamProject testManagementTeamProject = testManagement.GetTeamProject(teamProject);

// _testRunID is the Run ID of the Test Run

ITestRun testRun = testManagementTeamProject.TestRuns.Find(_testRunID);

// Get Failed Test Cases

ITestCaseResultCollection testcases = testRun.QueryResultsByOutcome(TestOutcome.Failed);

foreach (ITestCaseResult testcase in testcases)


       // Print Test Case Details

       Console.WriteLine("TestCase ID: " + testcase.TestCaseId);

       Console.WriteLine("TestCase Title: " + testcase.TestCaseTitle);

       Console.WriteLine("Error Message: " + testcase.ErrorMessage);


Similarly test cases which are Passed, Aborted, etc. can be found out by passing TestOutcome.Passed , TestOutcome.Aborted, etc