Using the combination of TFS API’s and PowerShell, you can easily manage your TFS test cases, either as part of a build process or from a tool that supports invoking PowerShell cmdlets or scripts. In this post, I’ll show how to make use of the [Microsoft.TeamFoundation.TestManagement.Client] API’s to manage test runs in TFS or Microsoft Test Manager. The test management client API’s are internally used by MS visual studio Ultimate/ Test Professional editions to manage TFS test plans, and cases.
At the end we’ll create a PowerShell module with the functions
that are needed for managing the test runs in TFS and use the functions to meet our requirements. The rest of the post contains sections defining the functions that are exposed as part of the Module.
Assemblies involved in the example:
The first step is to load the assemblies which are needed for our functions to interact with the TFS API’s
The Microsoft.TeamFoundation.Build.Client assembly is used to get the details of the latest build that will be used to create a test run.