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: