如何获取当前测试用例的结果,尤其是哪个Active, 因为草稿,我通过了。 enter image description here
答案 0 :(得分:0)
您首先可以检索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的状态。如果您想获得运行测试步骤的结果,还可以查看以下博客:MTM Testing Scorecard using TFS API