2016-12-01 37 views

回答

1

不,沒有任何方法像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() 
+0

非常感謝您的幫助...任何方式,我們可以在Excel中有這樣的宏...或電源外殼,將讀一個excel文件..這將避免代碼與測試步驟的混合....也將這保持格式化...... ????同時,我會檢查鏈接,並將繼續研究...... – basilbc

+0

@basilbc不,從宏觀的角度來看,無論如何都無法實現這一點。對於從powershell讀取excel文件,你可以參考這個問題的細節:http://stackoverflow.com/questions/19211632/read-excel-sheet-in-powershell –

相關問題