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

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

问题描述

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

We have a legacy of thousands of manual Test Cases created in Microsoft Test Manager in our on premises TFS 2013.

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

We are trying to move them to VSTS and it proved to be difficult.

据我所知,目前没有来自微软的官方迁移工具,尽管他们正在开发 一个用于完整数据迁移

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

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

We've tried a few third party tools:

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

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

We've also tried exporting-importing TFSVSTS 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.

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

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:

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

  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.

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

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.0Common7IDEPrivateAssembliesNewtonsoft.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天全站免登陆