Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

TFS API TestManagementService always returns null

Tags:

tfs

tfs-sdk

I'm trying to get test plans by using TFS API.

TfsTeamProjectCollection tfs = TfsTeamProjectCollectionFactory.GetTeamProjectCollection(new Uri("http://xxxxxxx:8080/tfs/DefaultCollection"));

var service = (ITestManagementService)tfs.GetService(typeof(ITestManagementService));

The variable "service" always returns null.

Do you have any idea, why?

like image 696
cerezza Avatar asked Oct 02 '12 08:10

cerezza


1 Answers

Try to make sure you that you are authenticated to the Team Project Collection before calling the Get Service command. This code snippet works correctly for me:

TfsTeamProjectCollection tpc = TfsTeamProjectCollectionFactory.GetTeamProjectCollection(new Uri("https://tfs.companyname.com/tfs/DefaultCollection"));
tpc.EnsureAuthenticated();

ITestManagementService service = tpc.GetService<ITestManagementService>();
like image 130
Ed Blankenship Avatar answered Sep 28 '22 04:09

Ed Blankenship