如何将MTM测试用例从TFS 2013迁移到VSTS? [英] How to migrate MTM Test Cases from TFS 2013 to VSTS?

查看:116
本文介绍了如何将MTM测试用例从TFS 2013迁移到VSTS?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我们的 TFS 2013内部,我们在Microsoft Test Manager中创建了数千个手动测试用例.

我们正试图将它们迁移到 VSTS ,事实证明这很困难.


I.

据我所见,目前没有Microsoft的官方迁移工具,尽管他们正在使用 OpsHub -免费版本的限制为2500超出了我们的价格,我们无法证明5,000美元的商业版本费用合理

  • TFS集成工具-似乎没有迁移根本没有测试用例(链接的文档证实了这一点)
  • MTMCopyTool -似乎没有迁移测试用例步骤,将其留空

  • III.

    我们还尝试了在Excel中导出-导入TFS \ VSTS查询. 似乎也可以导出Steps,但是它们全都连接在一个字段中,它们之间甚至没有换行符,这使它很混乱.


    IV.

    我们还尝试了使用第三方工具通过Excel导出-导入

    解决方案

    对于一次迁移,我可以建议几个选择:

    1. 从本地Web访问中的测试中心,创建一个包含所有测试用例的测试计划,然后切换到主窗格中的网格视图.在那里,您可以选择并复制所有测试用例(包括步骤,预期结果和其他测试用例字段),并将它们粘贴到VSTS项目中的等效视图中.

    2. 创建一个Powershell脚本,该脚本从本地TFS获取所有测试用例并将它们复制到VSTS中. 您可以在下面找到一个代码段. 警告:我尚未对其进行广泛的测试,因此适用通常的免责声明.请添加您可能想要复制的其他字段.

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

    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:

    解决方案

    For a one-shot migration I can suggest a couple of options:

    1. 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.

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

    这篇关于如何将MTM测试用例从TFS 2013迁移到VSTS?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

    查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆