【问题标题】:How to migrate MTM Test Cases from TFS 2013 to VSTS?如何将 MTM 测试用例从 TFS 2013 迁移到 VSTS?
【发布时间】:2016-10-03 17:01:24
【问题描述】:

在我们的本地 TFS 2013 中,我们在 Microsoft 测试管理器中创建了数千个手动 测试用例

我们正在尝试将它们移至 VSTS,但事实证明这很困难。


我。

据我所知,目前微软没有官方迁移工具,尽管他们正在开发one for full data migration


二。

我们尝试了一些第三方工具:

  • OpsHub - 免费版有 2500 个限制,我们超出了限制,我们无法证明商业版 5,000 美元的成本是合理的
  • TFS Integration Tools - 似乎根本没有迁移测试用例(链接中的文档证实了这一点)
  • MTMCopyTool - 似乎没有迁移测试用例的步骤,将它们留空

三。

我们还尝试在 Excel 中导出-导入 TFS\VSTS 查询。 这似乎也导出了步骤,但它们都连接在一个字段中,它们之间甚至没有换行符,这使得它非常混乱。


IV.

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

【问题讨论】:

  • 一个完整的迁移工具接受预览客户端。您可能需要与支持人员或 ALM 合作伙伴取得联系,以帮助您进入名单。
  • 我暂时不会尝试其他任何东西。
  • 你用 aforcina 的回答解决了这个问题吗?

标签: visual-studio tfs azure-devops microsoft-test-manager mtm


【解决方案1】:

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

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

  2. 创建一个 powershell 脚本,从本地 TFS 获取所有测试用例并将它们复制到 VSTS。 您可以在下面找到一个 sn-p。 警告:我没有对它进行广泛的测试,所以通常的免责声明适用。请添加您可能要复制的其他字段。

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

【讨论】:

  • 感谢您的意见。第一次尝试,它似乎将 Grid 限制为 20 个测试用例,有什么方法可以显示所有?
  • 我设法复制/粘贴了 25 个,因此剪贴板的整体大小可能会受到限制。我没有找到关于这个限制的文档,它看起来像是一个内部约束。所以如果你走这条路,你应该做多次复制/粘贴......我感觉到你的痛苦......
  • 我在上面的答案中添加了powershell代码sn-p。
  • 脚本工作正常,仍在使用。只是一个简单的问题 - 您加载的 Newtonsoft.Json.dll 中是否有任何需要?
  • 是的,显然 NewtonSoft.Json 是新的 TFS API 所需要的,因为如果不加载 Save 方法将会失败。我已经测试了从本地 2015.3 TFS 迁移到我的个人 VSTS 帐户的脚本。
猜你喜欢
  • 1970-01-01
  • 2018-05-06
  • 2019-11-19
  • 1970-01-01
  • 1970-01-01
  • 2016-12-13
  • 1970-01-01
  • 2018-07-16
  • 2016-04-20
相关资源
最近更新 更多