Migrate TFS Test Cases between Different TFS Team Projects or TFS Servers

Semi-Automation
0 Shares

In my team, we use MS Test Manager for Test Case Management Application. I had to migrate all of our test cases(2000) from our old TFS Team Project to a new one. Unfortunately, I found out that MS Test Manager has a built-in feature only for transferring test cases between test plans. This means that you can copy your test cases structure only between test plans in the same TFS Team Project.

However, you can use the Test Case Manager for the job.

Migrate TFS Test Cases Test Case Manager

How to Use Test Case Manager to Migrate TFS Test Cases?

  • Download the latest version of the tool from https://testcasemanager.codeplex.com
  • Connect to your TFS Team Project and specify your test plan
  • Click on “Migrate Test Cases” tab
  • Select Source Team Foundation Server Project
  • Select Source Test Plan
  • Select Destination Team Foundation Server Project
  • Select Destination Test Plan
  • Select Default JSON files folder
  • Select Test Suites to be skipped

The source test plan is used to get the initial tree of suites, it’s not used to filter the test cases for migration. The test cases are shared between different test plans. If you want to skip the migration of test cases that are used in various test plans, create a new suite in your source test plan named “ToBeSkipped”. Insert all test cases that you desire to be skipped into it. You can view all test cases if you click to the “All Test Cases” tab and then click “All” node of the Suites Tree.

Add the  “ToBeSkipped” suite to the “Test Suites To Be Skipped” grid of the “Migrate Test Cases” view.

The idea behind the JSON files is that if the process fails for some reason and you initialize a new migration, you don’t want to insert the already processed test cases again, shared steps or suites. The JSON files keep the current state of the migration process. You have a separate file for each phase of the procedure.

If the phase is started for the first time you should leave the “Retry JSON Path” empty, the application will create a new file with a new unique name. If problems emerge, specify the JSON file for the problematic step. The tool will ignore the already processed items.

Phases:

  1. Migrate Shared Steps
  2. Migrate Test Suites
  3. Migrate Test Cases
  4. Add Test Cases To Suites

Before you can create your test cases in your new team project, you need to create all referenced shared steps. Next you need to create their suites. Then you are ready to migrate the test cases. The last step is to add your test cases to their test suites. If something fails along the line, you need to load the generated JSON files because they keep all mappings between the old entities and the new ones. E.g. old shared step id – new shared step id. If this information is missing the creation of the new test cases is impossible.

The Test Suites listed in the “Test Suites To Be Skipped” will not be migrated. Test Cases placed in the suites listed there will not be processed. Of course, the suites with these names will also not be created in the Suite Tree of the destination Test Plan.

You can find the detailed log of the process in the Default Test Case Manager Log. It’s placed in your default Documents folder: %USERPROFILE%\Documents\TestCaseManager\ExecutionLog.log.

  • Lukasz

    That tool is great, but has a few issues. In my case migration completed successfully only when all test cases were assigned to test suite and have assigned person. When those conditions were not met, migration didn’t work and it looked like application didn’t do anything after click on buttons.

    • angelov.st.anton@gmail.com

      Hi there,

      Can you please send me your execution log in order to see the problem. You can find it under your user’s folder/TestCaseManager. Probably there we can find what the exact exception is.

      Thank you in advance!

      Anton

  • J-son

    I concur, this tool is great!

    I would like to do the same for bugs. Any tool out there of the same high quality that is able to to the job, including attachements, etc?

    Cheers,

    • Anton Angelov

      Hi J-son,

      Probably you to transfer the related bugs and attachment of the test cases in the TFS Team Project or?
      Also, I guess you need it to transfer items between different TFS Collections?

      Anton

  • Ryan

    Anton,
    I’ve run into some issues with this tool (The button to migrate test cases is never enabled, despite there being many test cases inside the Test Plan) in one TFS environment, though it functions flawlessly in another. I’ve also written Powershell Scripts to migrate attachments, comments, and areas after using your tool.

    I noticed that your personal website, and therefore the documentation, are now offline. I’m currently scouring your source code to see if I can figure out what’s wrong since I can’t seem to discern what the issue is via the log. Is the tool still being updated? Could you provide me with the migration docs that I can mirror on stackoverflow (for instance?) Any help is appreciated – I love what you did with the app, especially as a Zune fan :)

    Ryan

    Ryan

    • Hi Ryan,

      Currently, I’m not working on the tool anymore because my team stopped using TFS for test cases’ storage. I have just fixed the documentation links. The source code can be downloaded from my official GitHub account, you can find it at the top of the Automate The Planet homepage. Also, I can add you as a contributor to the project and any fixes, and new features can be merged into the main branch. Also, if you need any assistance with the code, feel free to write me.

      -A