$project.TestPlans is missing in powershell?
-
Monday, April 26, 2010 11:05 PM
Using VS2010, in C#, I get a ITestManagementService project, and execute project.TestPlans.Query("SELECT * FROM TestPlan"));
However, in powershell $project.TestPlans is null. What am I doing wrong?
thx!
[void][System.Reflection.Assembly]::LoadWithPartialName("Microsoft.TeamFoundation.Client")
[void][System.Reflection.Assembly]::LoadWithPartialName("Microsoft.TeamFoundation.TestManagement.Client")
[void][System.Reflection.Assembly]::LoadWithPartialName("Microsoft.TeamFoundation.Build.Client")
[psobject] $tfs = [Microsoft.TeamFoundation.Client.TeamFoundationServerFactory]::GetServer($tfsServerUri)
[psobject] $tms = $tfs.GetService([Microsoft.TeamFoundation.TestManagement.Client.ITestManagementService]);
[psobject] $project = $tms.GetTeamProject($tfsProjectName)
[psobject] $testplans = [Microsoft.TeamFoundation.TestManagement.Client.ITestManagementTeamProject]$project.TestPlans- Edited by Brian C Williams Monday, April 26, 2010 11:09 PM added my code
- Moved by Edwer Fang Tuesday, April 27, 2010 5:25 AM (From:Visual Studio Team System - Testing)
All Replies
-
Tuesday, April 27, 2010 5:24 AM
Hello,
I am moving this post to Testing with Visual Studio Test Manager (MTM) Forum so you can get better and quicker response as there are more experts on it.
Thanks for your understanding.
Edwer Fang [MSFT]
MSDN Subscriber Support in Forum
If you have any feedback on our support, please contact msdnmg @ microsoft.com
Please remember to mark the replies as answers if they help and unmark them if they provide no help.
Send us any feedback you have about the help from MSFT at fbmsdn@microsoft.com. -
Friday, February 18, 2011 6:22 PMI have the same problem.
-
Thursday, May 03, 2012 2:29 PM
Same problem here.
-
Thursday, May 03, 2012 3:28 PMI belive you need to explicitly load some assemblies. Try Microsoft.TeamFoundation.TestManagement.Client.
-
Monday, November 12, 2012 11:05 AMOwner
Folks,
This is happening because of following bug in powershell.
https://connect.microsoft.com/feedback/ViewFeedback.aspx?FeedbackID=249840&SiteID=99
And as mentioned in the above bug, you can use reflection or the Get-Interface method to access it.
Here is the poweshell snippet I used to make it work.
[Microsoft.TeamFoundation.TestManagement.Client.ITestManagementTeamProject] $tcmProject = $tcmService.GetTeamProject($projectName);
$testPlansProperty = [Microsoft.TeamFoundation.TestManagement.Client.ITestManagementTeamProject].GetProperty("TestPlans").GetGetMethod();
$testPlans = $testPlansProperty.Invoke($tcmProject, "instance,public", $null, $null, $null);Regards
Aseem Bansal
- Proposed As Answer by Aseem Bansal [MSFT]Microsoft Employee, Owner Monday, November 12, 2012 11:05 AM
- Marked As Answer by niveditabawa_MSFTMicrosoft Employee, Moderator Wednesday, November 21, 2012 2:49 PM

