Buck Hodges posted a
very useful CHM for those of us developing against the new TFS 2008 object model. I was looking for a way to get test data out of the object model, and it is much improved over 2005!
To get data you need to do the following process:
1) get an instance of team foundation server
2) get an instance of the IBuildServer service
3) retrieve an instance of IBuildDetail associated with the build uri
4) retrieve an instance of the IConfigurationSummary for the specific platform and flavor desired
5) iterate over the list of ITestSummary objects in the IConfigurationSummary!
Here's some sample code to get your test data out of your build, I learned about the 'Information' nodes via the
chm, and am very happy with the ability to pull out different types of data without having to perform the check manually myself.
Happy coding!
using Microsoft.TeamFoundation.Client;
using Microsoft.TeamFoundation.Build.Client;
using Microsoft.TeamFoundation.Build.Common;
...
TeamFoundationServer tfs = new TeamFoundationServer( TFS_URL, TFS_CREDENTIALS );
tfs.Authenticate();
IBuildServer buildSvr = tfs.GetService(typeof(IBuildServer));
Uri myBuildURI = new Uri("vstfs:///Build/Build/YOURBUILDURI");
IBuildDetail buildDetail = buildSvr.GetAllBuildDetails( buildURI );
IConfigurationSummary cfgSum = InformationNodeConverters.GetConfigurationSummary( buildDetail, FLAVOR, PLATFORM);
foreach( ITestSummary testSum in cfgSum.TestSummaries)
{
...
}