Can I access the TestPoint through the TestPointHierarchy?
-
22. března 2012 22:32
Hello,
I am using the below code to move through each test suite in a testplan. I do this so I can record the "path" of each test case. (Ex. <TestPlan>/<TestSuite1>/<TestSuite2>/TestCase) I access the test case using HEntry.Suite.TestCases at each TestSuite in the hierarchy. Is it possible to access the said TestCases TestPoints as I'm accessing the TestCases in the TestSuite? Below is the code I use to get the TestPlan TestPoint Hierarchy. I have only seen the ability to access TestPoints through the iTestPlan Interface methods. If I even knew the TestPointID I could call <TestPlan>.FindTestPoint but that would involve a call for every test point. Seems like I should be able to access the TestPoint from the HierarchyEntry items returned by <TestPlan>.QueryTestPointHierarchy. Thanks for your time.
string testpointstr = "Select * from TestPoint"; HierarchyEntry HEntry = i.QueryTestPointHierarchy(testpointstr);
Všechny reakce
-
26. března 2012 5:44Moderátor
Hi Eric,
Thank you for your question.
I am trying to involve someone familiar with this topic to further look at this issue. There might be some time delay. Appreciate your patience.
In addition, some information for you to refer. QueryTestPointHierarchy returns test suites' hierarchy that the test case contains test points, just return the root of the test suites hierarchy. QueryTestPoints method finds and returns all test points belongs to the test plan.
Thank you for your understanding and support.
Best regards,
Lily Wu [MSFT]
MSDN Community Support | Feedback to us
-
2. dubna 2012 23:51Hi Lily, Thank you for your reply. I am using QueryTestPointHierarchy so I can get the test suite path for each testpoint in the testplan. I currently write the test_suite_path and test_case_id to file A. I would also like to write the testpoint.MostRecentResultOutcome.ToString() value to file A. I would then take file A and create the same testplan in a new collection->Project and create the new test points with testpoint.MostRecentOutcome set to the value found in file A. My tool currently can get to the iTestSuiteEntry items(ie. TestCases) using the QueryTestPointHierarchy. From there I can see anything accessible from the iTestSuiteEntry item(ie. test case id, test point assignments) but I cannot seem to get to the iTestPoint object. Thanks for your time. Hope the further details above help. Eric
-
3. dubna 2012 18:11Vlastník
It is possible to get the get all test points for as Test Plan in one shot as you are looping through the Test Suites follows:
public static IList<ITestPoint> GetTestPoints(ITestPlan testPlan, int TestSuiteID)
{
// Create a static suite within the plan and add all the test cases.
ITestPointCollection TestPointCollection = testPlan.QueryTestPoints("SELECT * FROM TestPoint WHERE SuiteId = " + TestSuiteID);
return new List<ITestPoint>(TestPointCollection);
}IList<ITestPoint> testPoints = GetTestPoints(TestPlan, TestSte.Id);
Console.WriteLine("Test Point Data : ");
foreach (ITestPoint tp in testPoints)
{
Console.WriteLine(" Area Path : " + tp.Plan.AreaPath.ToString());
}
The QueryTestPoints can be used to return all the test points data as a collection. Hope this can help. If not, we may be able to help further via an advisory support case opened with Microsoft support, and we'll likely require your source at that point. So if you cannot determine your answer here or on your own, consider opening a support case with us. Visit this link to see the various support options that are available to better meet your needs: http://support.microsoft.com/default.aspx?id=fh;en-us;offerprophone.Trevor Hancock (Microsoft)
Please remember to "Mark As Answer" the replies that help.- Navržen jako odpověď Trevor HancockMicrosoft Employee, Owner 3. dubna 2012 18:11