TFS API TestManagementService always returns null

I am trying to get test plans using the 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 ideas why?

+5
source share
2 answers

Perhaps you are linking to different versions of referenced assemblies by mixing different versions of Visual Studio assemblies? Example:

  • Microsoft.TeamFoundation.Client v11.0 (VS 2012)
  • Microsoft.TeamFoundation.TestManagement.Client v12.0 (VS 2013)

I had the same problem GetService<ITestManagementService>()always returning null even when it returned a GetService<VersionControlServer>()good (non-zero) value.

MSDN - VersionControlServer null : v11.0 (VS2012) v12. 0 (VS2013). v11.0 .

+2

, Get Service. :

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

ITestManagementService service = tpc.GetService<ITestManagementService>();
+4

All Articles