【问题标题】:Get test case outcome/result using TFS API使用 TFS API 获取测试用例结果/结果
【发布时间】:2018-12-10 16:19:28
【问题描述】:

如何获取 当前 测试用例结果,尤其是那些活跃的, 因为我通过了。 enter image description here

【问题讨论】:

    标签: tfs tfs-sdk


    【解决方案1】:

    您可以首先检索 Active 测试用例是使用 ITestPlan.QueryTestPoints 方法和 TestPointState.Ready 属性。

    以下代码 sn-p 将列出所有活动测试用例的 ID。请看下面:

    ITestManagementService testManagementService = testHelper.GetTestManagementService();
                //Get Team Project
                ITestManagementTeamProject teamProjects= testManagementService.GetTeamProject("TeamProjectName");
     //Get the test plan
                ITestPlan testPlan=teamProjects.TestPlans.Find(int.Parse("3")); //3 is the test plan id on my side
                // Get test points
                ITestPointCollection testPoints= testPlan.QueryTestPoints("SELECT * FROM TestPoint");
                foreach (var item in testPoints)
                {
                    if (item.State==TestPointState.Ready)
                    {
                        Console.WriteLine(item.TestCaseId);
                    }
                }
    

    那么您只需要获取列出的 CaseID 的状态即可。如果你想得到运行测试Step的结果,你也可以看看这个博客:MTM Testing Scorecard using TFS API

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2015-12-25
      • 1970-01-01
      • 2018-05-12
      • 2017-01-15
      • 2018-02-05
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多