简体   繁体   中英

How to update test case in TFS using power tools?

Is there any way we can update test steps in a test case in TFS using power tools (command line) ? (Looking for solution other than MTM, Grid & 3rd party tools).

Nope. Microsoft provide MTM, Web, and Grid. You would be looking at third party tools.

Test Management Rest API: https://www.visualstudio.com/en-us/docs/integrate/api/test/cases

There is however both a RestAPI (linked above) and a full client API. Both of which can be accessed from PowerShell or Code.

No, there isn't any way to update the test steps via Power Tools just as MrHinsh mentioned. If you want to update the test step from powershell, you can call the TFS API from powershell, refer to "Beyond the basics" section in this link for details.

Here is the code to update the test steps:

$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()

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM