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
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();
}