none
通过TfsTeamProjectCollection无法获取测试服务 RRS feed

  • 问题

  • 1、通过TfsTeamProjectCollection无法获取测试服务
            private static ITestManagementTeamProject ConnnectTFS(string url, string projectName)
            {
                Uri tfsUri = new Uri(url);
                TfsTeamProjectCollection configServer = new TfsTeamProjectCollection(tfsUri);
                ITestManagementService service = configServer.GetService<ITestManagementService>();
                WorkItemStore workStore = configServer.GetService<WorkItemStore>();
                Project project = workStore.Projects[projectName];

                ITestManagementTeamProject tmtp = service.GetTeamProject(projectName);

                return tmtp;
            }


     ITestManagementService service = configServer.GetService<ITestManagementService>(); 返回为null,请问是什么原因?

    2ITestCase实例如何对扩展属性进行赋值?
    2016年1月25日 9:34

全部回复

  • 你好,

    你可以参考下面这个例子去获得test case和编辑steps.

     

    TfsTeamProjectCollection teamCollection; TfsTeamProjectCollection   teamCollection;

                  ITestManagementService service;

                  ITestManagementTeamProject project;

                  var picker = new TeamProjectPicker(TeamProjectPickerMode.SingleProject,   false);

                  picker.ShowDialog();

                  if (picker.SelectedTeamProjectCollection != null   && picker.SelectedProjects != null)

                  {

                      teamCollection = picker.SelectedTeamProjectCollection;

                      service = teamCollection.GetService<ITestManagementService>();

                      project = service.GetTeamProject(picker.SelectedProjects.First().Name);

                  }

                  else

                  {

                      return;

                  }

               

                  ITestCase testCase =   project.TestCases.Find(46);

     

                  int count = testCase.Actions.Count;

                  foreach (ITestStep a in   testCase.Actions)

                  {

                      a.Title = "title";

                      a.ExpectedResult = "expected";

                  }

                  testCase.Save();

                  testCase.Refresh();

                  return;

     


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.


    2016年1月26日 4:21
    版主
  • 要获得ITestManagementService,下面这个代码就可以直接拿到

                TfsTeamProjectCollection tfs = new TfsTeamProjectCollection(new Uri("url"));

                tfs.EnsureAuthenticated();

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

    你可以在这篇博客里了解到更多信息:http://geekswithblogs.net/TarunArora/archive/2012/05/16/get-detailed-build-test-results-using-the-tfs-api.aspx


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    2016年1月26日 4:26
    版主