【发布时间】:2016-12-08 09:58:57
【问题描述】:
有什么方法可以使用电动工具(命令行)更新 TFS 测试用例中的测试步骤? (寻找 MTM、Grid 和 3rd 方工具以外的解决方案)。
【问题讨论】:
标签: powershell tfs tfs-power-tools
有什么方法可以使用电动工具(命令行)更新 TFS 测试用例中的测试步骤? (寻找 MTM、Grid 和 3rd 方工具以外的解决方案)。
【问题讨论】:
标签: powershell tfs tfs-power-tools
不。 Microsoft 提供 MTM、Web 和 Grid。您会查看第三方工具。
测试管理 Rest API:https://www.visualstudio.com/en-us/docs/integrate/api/test/cases
然而,有一个 RestAPI(上面链接)和一个完整的客户端 API。两者都可以从 PowerShell 或 Code 访问。
【讨论】:
不,正如 MrHinsh 提到的那样,没有任何方法可以通过 Power Tools 更新测试步骤。如果您想从 powershell 更新测试步骤,您可以从 powershell 调用 TFS API,详细信息请参阅this link 中的“超越基础”部分。
这里是更新测试步骤的代码:
$collectionurl = "http://TFSCollectionURL/";
$tfs = [Microsoft.TeamFoundation.Client.TfsTeamProjectCollectionFactory]::GetTeamProjectCollection($collectionurl);
##$buildservice = $tfs.GetService([Microsoft.TeamFoundation.Build.Client.IBuildServer]);
##$workitemservice = $tfs.GetService([Microsoft.TeamFoundation.WorkItemTracking.Client.WorkItemStore]);
$testservice = $tfs.GetService([Microsoft.TeamFoundation.TestManagement.Client.ITestManagementService])
$project = "ProjectName";
$testcaseid = 1;
$testproject = $testservice.GetTeamProject($project);
$testcase = $testproject.TestCases.Find($testcaseid);
##Update the first step
$teststep1 = $testcase.Actions[0]
$teststep1.Title = "New Action"
$teststep1.ExpectedResult = "New Expected Result"
##Update the second step
$teststep2 = $testcase.Actions[1]
$teststep2.Title = "New Action"
$teststep2.ExpectedResult = "New Expected Result"
$testcase.Save()
【讨论】: