Manage TFS Test Plans C# Code

Manage TFS Test Plans C# Code

TFS Test API
0 Shares
Manage TFS Test Plans C# Code

To use TFS Test Plans via code, you should first create TFS Collection and Team Test Project. You can find more information in my previous post: How to: Connect to TFS Team Project C# Code.
In Microsoft Test Manager, you can view, create, delete test plans. Here I am going to show you how to do these actions via C# code.

Create TFS Test Plans

First create an instance of your team project and next use the code below to create your first test plan:

Delete TFS Test Plans

The removing process is also very straightforward:

Create TFS Queries

However there isn’t a very “clean” way to get all test plans in the team project, so you need to write a small SQL query like the following:

  • Islam Abd Alazez

    My proplem is there is a task assigned to me in my work, they want me to customize Microsoft test manager (MTM) test plan by C# code. to be more specific i want to add custom fields and custom controls to it. Can anybody guide where to start from ?

    Thanks.

    • Anton Angelov

      Hi Islam,

      In my opinion, the thing that you want to do, is to change the TFS Item Template for the Test Plan. You can do it using Microsoft TFS Power Tools.
      You can find more information in the following post: . One year ago I use them to add an additional field to our TFS Test Case Item.

      I hope that the above information helps you!

      All the best,
      Anton