We have a legacy of thousands of manual Test Cases created in Microsoft Test Manager in our on premises TFS 2013.
We are trying to move them to VSTS and it proved to be difficult.
I.
As far as I can see at the moment there is no official migration tool from Microsoft, although they are working on one for full data migration
II.
We've tried a few third party tools:
- OpsHub - free version has a 2500 limit which we exceed, and we can't justify $5,000 cost of commercial version
- TFS Integration Tools - doesn't seem to migrate Test Cases at all (documentation by the link confirms this)
- MTMCopyTool - doesn't seem to migrated Steps of Test Cases, leaves them empty
III.
We've also tried exporting-importing TFS\VSTS Query in Excel. Which seems to export Steps too but all of them concatenated in one field, no even new line character between them, which makes it quite messy.
IV.
We've also tried using third part tool to export-import via Excel:
- to export: https://tfstestcaseexporttoexcel.codeplex.com/ - seems to export everything fine, including Steps! Not sure how to import this file though to VSTS
- to import: Test Case Migrator Plus just crashes on my machine, though source code is available so maybe I'll try to play with it
For a one-shot migration I can suggest a couple of options:
From the test hub in your on-premises web access, create a test plan including all the test cases and then switch to the grid view in the main pane. There you can select and copy all test cases (including steps, expected results and other test case fields) and paste them into the equivalent view in the VSTS project.
Create a powershell script that gets all the test cases from your on-premises TFS and copies them into VSTS. Below you can find a snippet. Caveat: I have not tested it extensively, so usual disclaimers apply. Please add additional fields you may want to copy.
$VerbosePreference = "Continue" $tfsSource="the collection url that you want to copy form (eg. http://yourserver/tfs/yourcollection)"; $tpSource="the team project containing the test cases you want to copy form"; $tfsDest="the collection url that you want to copy to (eg. https://youraccount.visualstudio.com/DefaultCollection"); $tpDest="the team project containing the test cases you want to copy to"; [Reflection.Assembly]::LoadWithPartialName(‘Microsoft.TeamFoundation.Client’) [Reflection.Assembly]::LoadWithPartialName(‘Microsoft.TeamFoundation.TestManagement.Client’) [Reflection.Assembly]::LoadFile("C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\PrivateAssemblies\Newtonsoft.Json.dll") $sourceTpc = [Microsoft.TeamFoundation.Client.TfsTeamProjectCollectionFactory]::GetTeamProjectCollection($tfsSource) $sourceTcm = $sourceTpc.GetService([Microsoft.TeamFoundation.TestManagement.Client.ITestManagementService]) $sourceProject = $sourceTcm.GetTeamProject($tpSource); $sourceTestCases = $sourceProject.TestCases.Query(“SELECT * FROM WorkItem”); $destTpc= [Microsoft.TeamFoundation.Client.TfsTeamProjectCollectionFactory]::GetTeamProjectCollection($tfsDest) $destTcm = $destTpc.GetService([Microsoft.TeamFoundation.TestManagement.Client.ITestManagementService]) $destProject = $destTcm.GetTeamProject($tpDest); foreach ($tc in $sourceTestCases) { Write-Verbose ("Copying Test Case {0} - {1}" -f $tc.Id, $tc.Title) $destTestCase= $destProject.TestCases.Create(); $destTestCase.Title = $tc.Title; $destTestCase.Priority = $tc.Priority; foreach ($step in $tc.Actions) { $destStep= $destTestCase.CreateTestStep(); $destStep.Title= $step.Title $destStep.TestStepType= $step.TestStepType $destStep.Description= $step.Description $destStep.ExpectedResult= $step.ExpectedResult; $destTestCase.Actions.Add($destStep); } $destTestCase.Save(); }
来源:https://stackoverflow.com/questions/39836734/how-to-migrate-mtm-test-cases-from-tfs-2013-to-vsts