【发布时间】:2018-12-10 16:19:28
【问题描述】:
如何获取 当前 测试用例结果,尤其是那些活跃的, 因为我通过了。 enter image description here
【问题讨论】:
如何获取 当前 测试用例结果,尤其是那些活跃的, 因为我通过了。 enter image description here
【问题讨论】:
您可以首先检索 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
【讨论】: