One of my customer is running into an issue while customizing his BDT workflow and to debug the issue, I have just now created a power-shell script which lists down the test points belonging to a particular suite/configuration. Since I have not seen any power-shell script on this till now (probably because of the issue reported here but with the help of Dhruv, I was able to get past that), I think it should be really useful for all of you.  Enjoy !!

# Load Client Assembly
[Reflection.Assembly]::Load(“Microsoft.TeamFoundation.Client, Version=11.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a”);
[Reflection.Assembly]::Load(“Microsoft.TeamFoundation.TestManagement.Client, Version=11.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a”);
[Reflection.Assembly]::Load(“Microsoft.TeamFoundation.TestManagement.Common, Version=11.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a”);
 
# Define parameters
$tfsCollectionUrl = “
http://myserver:8080/tfs/DefaultCollection”;
$projectName = "DefaultProject";
$planId = "1";
$suiteId = "7";
$configId = "1";

# Connect to tfs
$tfsCollection = [Microsoft.TeamFoundation.Client.TfsTeamProjectCollectionFactory]::GetTeamProjectCollection($tfsCollectionUrl);
$tcmService = $tfsCollection.GetService([Microsoft.TeamFoundation.TestManagement.Client.ITestManagementService]);
[Microsoft.TeamFoundation.TestManagement.Client.ITestManagementTeamProject] $tcmProject = $tcmService.GetTeamProject($projectName);

# Query for test plan/points
$testPlansProperty = [Microsoft.TeamFoundation.TestManagement.Client.ITestManagementTeamProject].GetProperty("TestPlans").GetGetMethod();
$testPlans = $testPlansProperty.Invoke($tcmProject, "instance,public", $null, $null, $null);

$testPlan = $testPlans.Find($planId);
$pointsQueryWiql = [string]::Format("SELECT * FROM TestPoint WHERE SuiteId={0} AND ConfigurationId={1}", $suiteId,$configId);
$testPoints = $testPlan.QueryTestPoints($pointsQueryWiql);

Write-Host ” ================================ “
Write-Host “Testpoints: “$testPoints