TFS-测试案例首次运行通过率 [英] TFS -Test Case First Run Pass Rate
问题描述
您好!
我正在尝试测量首次运行时传递的测试用例数。
I am trying to measure how many test cases are being Passed on the first run attempt.
无论如何在TFS和/或MTM中执行此操作?
Is there anyway to do this in TFS and/or MTM?
推荐答案
嗨Zack ,
Hi Zack,
没有默认的方法来获取测试用例结果,你需要使用api来检索信息。
There is no default way to get test cases results, you need to use api to retrieve the information.
这是一个代码片段到获取测试用例的最后结果供您参考:
Here is a code snippet to get the last result of a test case for your reference:
TfsTeamProjectCollection teamCollection;
ITestManagementService 服务;
           
ITestManagementTeamProject 项目;
           
var picker =
new
TeamProjectPicker ( TeamProjectPickerMode 。SingleProject,
false ) ;
var picker = new TeamProjectPicker(TeamProjectPickerMode.SingleProject, false);
;      picker.ShowDialog();
        
if (picker.SelectedTeamProjectCollection!=
null && picker.SelectedProjects!=
null )
  ;  {
;          teamCollection = picker.SelectedTeamProjectCollection;
&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP; service = teamCollection.GetService< ITestManagementService >();
&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP; project = service.GetTeamProject(picker.SelectedProjects.First()。Name);
&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP; }
;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;
else
{
  ;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;
return ;
&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP; }
;&NBSP;&NBSP;
var
result = project.TestResults.ByTestId(180).Last();
var
id = result.Id;
祝你好运,< span style ="color:black; font-family:Consolas; font-size:9.5pt">
这篇关于TFS-测试案例首次运行通过率的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!