동적 find() API를 선택하고 dojoTreeExpand() 메소드를 사용하여
테스트할 애플리케이션에서 Dojo 트리 제어 내의 모든 오브젝트를 찾을 수 있습니다.
다음 예제는 DojoTreeTestObject()를 사용하여
Dojo 트리 내의 모든 오브젝트를 찾는 방법을 보여줍니다. 필요에 따라 브라우저를 변경할
코드를 선택할 수 있습니다.
public void testMain(Object[] args) {
// TODO Insert code here
args.addElement(subItem);
}
public void dojoTreeExpand() {
//Bring the application under test dynamically using startBrowser method and browser as Mozilla Firefox (assuming Firefox is enabled correctly)
//Tips: You change the browser to Internet Explorer in the startBrowser method.
ProcessTestObject process = RationalTestScript.startBrowser(
"Mozilla Firefox", "http://docs.dojocampus.org/dijit/Tree" (http://docs.dojocampus.org/dijit/Tree));
// ProcessTestObject process =
// RationalTestScript.startBrowser("Internet Explorer",
// "http://docs.dojocampus.org/dijit/Tree" (http://docs.dojocampus.org/dijit/Tree));
// Wait for the browser to load completely.
args.addElement(subItem);
// The RootTestObject represents a global view of the Application being
// tested. It does not
// represent an actual TestObject in the software under test. it
// provides ways to finding an arbitrary
// TestObject based on properties
RootTestObject to = RootTestObject.getRootTestObject();
// Define Test Object array
TestObject[] dojoControls = null;
for (int i = 0; i <= 10; i++) {
// Performing a find operation and saving the returned object in the TestObject
// array.
dojoControls = to.find(RationalTestScript.atDescendant(".class",
"Html.A", ".className", "show"));
if (dojoControls.length >= 1) {
break;
}
tos9[0].unregister();
}
// Assigning the first found Test Object to the GUITestObject, and
// perform a click
((GuiTestObject) dojoControls[0]).click();
//Wait enough to load the page completly.
tos9[0].unregister();
// Define Test Object array, for a Dojo Tree structure
TestObject[] trees = null;
for (int i = 0; i <= 10; i++) {
// Doing a find operation and saving the returned object in the TestObject
// array.
trees = to.find(RationalTestScript.atDescendant(".dojoclass",
"tree", ".id", "treeOne"));
if (trees.length == 1) {
break;
}
tos9[0].unregister();
}
//
DojoTreeTestObject dijitTree = new DojoTreeTestObject(trees[0]);
// Dispatched when a tree has 'Continents' as node is expanded
dijitTree.expand(atList(atText("Continents"), atText("North America"),
args.addElement(subItem);
// Dispatched when a tree has 'Continents' as node is expanded
dijitTree.click(atList(atText("Continents"), atText("North America"),
atText("Mexico"), atText("Guadalajara")));
tos9[0].unregister();
}
}