如何在 Rational Functional Tester 中获取树的所有节点?我已经尝试使用getTestdata()
但无法解决问题?
代码片段:
ITestDataTree iTreeData =(ITestDataTree)businessObj.smi_LocTreePricingRules().getTestData("tree");
ITestDataTreeNodes iNodes = iTreeData.getTreeNodes();
System.out.println("node count:"+iNodes.getNodeCount());
ITestDataTreeNode[] rootNodes = iNodes.getRootNodes();
// System.out.println(iNodes.getNodeCount());
// ITestDataTreeNodes nodes= tree.getTreeNodes();
System.out.println(rootNodes.length);
for(int i = 0; i < rootNodes.length; i++) {
genericObj.showTree(rootNodes[i]); //This showTree method is present in another GenericLib class. public void showTree(ITestDataTreeNode node)
{
//Recursive method to print out tree nodes with proper indenting.
//Determine number of tabs to use - to properly indent tree
//Print out node name + number of children
//System.out.println( node.getNode() + " (" + node.getChildCount() + "children)" );
//Determine if node has children; recursively call this same
//method to print out child nodes.
ITestDataTreeNode[] children = node.getChildren();
int childCount = ( children != null ? children.length : 0 );
for ( int i = 0; i < childCount; ++i )
showTree(children[i]);
String synb = node.getNode().toString();
System.out.println( node.getNode() + " (" + node.getChildCount() + "children)" );
}
但是这段代码给了我根节点的直接子节点。我怎样才能得到像子节点一样的所有节点?