我们正在尝试将 UFT 脚本与 MTM 集成。到目前为止,我们成功地做到了。我们已经创建了许多使用 TFS API 的应用程序,并且我们对它感到满意。
问题:我们如何更改测试用例的自动化状态?
我们做了什么:
TfsTeamProjectCollection tfs = TfsTeamProjectCollectionFactory.GetTeamProjectCollection(new Uri("Your URL"));
ITestManagementTeamProject project = tfs.GetService<ITestManagementService>().GetTeamProject("Ypur Project Name");
ITestPlan testPlan = project.TestPlans.find("Your test plan ID");
ItestCaseCollection testcasecollection = testPlan.RootSuite.AllTestCases;
foreach (ITestCase testcase in testcasecollection)
{
if (testcase.Id=="YourTestcaseID")
{
//Now here we need tochange status of test case from Not Automated to automated
//we can change area path, title ,priority etc using TFS provided methods, but we cant change Automation status from Not Automated to others
testcase.status="Active"; // to change status of test case from closed to active.
// What is the method to change Automation status for a test case?? we only find method to get the automation status by using below method which is read only and returns value.
string str=testcase.IsAutomated(); // this returns but not sets
}
}
所以简而言之,我们有什么方法可以使用 C# 更改 MTM/TFS 中测试用例的自动化状态,就像我们更改状态和其他方法一样?