tfs - 使用 TFS API 获取测试用例结果/结果
问题描述
如何获取当前的测试用例结果,尤其是那些活跃的,因为我得到了通过。 在此处输入图像描述
解决方案
您可以首先检索 Active 测试用例是使用 ITestPlan.QueryTestPoints 方法和 TestPointState.Ready 属性。
以下代码片段将列出所有活动测试用例的 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 的状态。如果您想获得运行测试步骤的结果,您还可以查看此博客:使用 TFS API 的 MTM 测试记分卡
推荐阅读
- node.js - 在 Node.js 中读取计算机的声音输出并分析声音
- python - 如何设置索引 NaN(空单元格)
- css - 如何在 Cypress 中访问下拉选择,出现错误:元素已与 DOM 分离
- reactjs - React - 在 JSX 中使用 for 循环
- swift - 如何在 SwiftUI 中通过用户点击添加折线和注释
- javascript - 出于某种原因,我的 if 语句无论如何都会触发
- c# - JWT授权失败.net核心
- gcloud - 为什么 APT 一直说 gcloud SDK 不存在?
- selenium - 在不同的环境中运行 selenium
- java - 如何在 Android 上调整键盘焦点布局?