尝试连接到TFS服务器并获取“测试环境”。有人可以指导我 [英] Trying to connect to TFS server and get the "Test environment". Can some one guid me to it

查看:64
本文介绍了尝试连接到TFS服务器并获取“测试环境”。有人可以指导我的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试连接到TFS服务器并获取"测试环境"。我们在MTM中看到的字段数据。


但没有得到它。



我关注的是下面:



TfsTeamProjectCollection tfctc = new TfsTeamProjectCollection(new Uri(" My URL"));

ITestManagementService testmanagementService = tfctc.GetService< ITestManagementService>();
$
var teamproject = testmanagementService.GetTeamProject(" teamprojectname");

IEnumerable< ITestRun> testruns = testmanagementService.QueryTestRuns(" select * From TestRun where testRunId = 213734");




testruns 
 我几乎全部我需要的详细信息  TotalTests,  IncompleteTests,  PassedTests,State,  Title ..... 


但无法获得"测试环境" ;包含远程机器名称的数据......



有人可以看一次....并帮助我


解决方案

嗨coolv,


感谢您发布帖子。


使用ITestRun类,您只能通过测试运行获得TestEnvironmentId。但是您可以使用测试环境id来获取ITestEnvironment对象。然后你可以使用 找到测试控制器名称。 ITestEnvironment对象。

 

.......
IEnumerable< ITestRun> testruns = testService.QueryTestRuns(" select * From TestRun where TestRunId = 213734");
foreach(ITestRun tr in testruns)
{
// get test environment
var testenv = tr.TestEnvironmentId;
ITestEnvironment testEnvironment = teamProject.TestEnvironments.Find(testenv);
var testController = testEnvironment.TestController;

Console.WriteLine(testController.DisplayName);
}


最好的问候



I am Trying to connect to TFS server and get the "Test environment" field data that we see in MTM.

but not getting it.

I am following the below:

TfsTeamProjectCollection tfctc = new TfsTeamProjectCollection(new Uri("My URL"));
ITestManagementService testmanagementService = tfctc.GetService<ITestManagementService>();
var teamproject = testmanagementService.GetTeamProject("teamprojectname");
IEnumerable<ITestRun> testruns = testmanagementService.QueryTestRuns("select * From TestRun where TestRunId = 213734");

in the testruns  i got almost all the details that i need like TotalTests, IncompleteTests, PassedTests, State, Title ..... 

but not able to get the "Test environment" data which contains the remote machine name ......

can some one look into it once.... and help me out

解决方案

Hi coolv,

Thank you for post there.

Using the ITestRun class, you could only get the TestEnvironmentId through test run. But you could using the test environment id to get the ITestEnvironment object. Then you could find test controller name using  ITestEnvironment object.

....... IEnumerable<ITestRun> testruns = testService.QueryTestRuns("select * From TestRun where TestRunId = 213734"); foreach (ITestRun tr in testruns) { //get test environment var testenv = tr.TestEnvironmentId; ITestEnvironment testEnvironment = teamProject.TestEnvironments.Find(testenv); var testController = testEnvironment.TestController;

Console.WriteLine(testController.DisplayName); }

Best regards


这篇关于尝试连接到TFS服务器并获取“测试环境”。有人可以指导我的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆