Ricerca di oggetti di test

Functional Tester consente di ricercare uno o più oggetti di test che corrispondono al criterio di ricerca specificato. La ricerca è basata sulle coppie nome/valore che rappresentano le proprietà dell'oggetto di test o gli oggetti di test da ricercare. La ricerca può essere globale o limitata agli elementi secondari di un oggetto di test principale.

Functional Tester supporta un elemento RootTestObject per rappresentare una vista globale del software in fase di test. Per eseguire una ricerca globale, è necessario richiamare il metodo find in RootTestObject. Il richiamo del metodo find oggetto di test ricercherà solo gli elementi secondari di tale oggetto di test.

Il primo argomento nel metodo find è un elemento secondario delle proprietà di ricerca. Il secondo argomento facoltativo è un indicatore che segnala se includere solo gli elementi secondari nella ricerca nella mappa di oggetti di test. I valori validi per gli elementi secondari delle proprietà sono:

Vi sono proprietà speciali che si applicano a RootTestObject.find, incluso quanto segue:

Esempi:

TestObject[] foundTOs ;
RootTestObject root = RootTestObject.getRootTestObject() ;
// Find all toplevel windows in the Windows domain with caption "My
// Document"
CaptionText caption = new CaptionText("My Document") ;
foundTOs = root.find(atChild(".domain", "Win", ".caption",
     caption)) ;

// Find any dialogs, then return their children
// "OK" buttons.
RegularExpression dialogRE = new
     RegularExpression("*dialog", false) ;
RegularExpression buttonRE = new
     RegularExpression("*button", false) ;
foundTOs = root.find(atList(atDescendant(".class",
                     dialogRE), 
                     atChild(".class", buttonRE,".value", 
                     "OK"))) ;

// Start Notepad, dynamically enable that process,
// find its top-level window that matches the process id
// and get its descendant text window.
	ProcessTestObject p1 = StartApp("Notepad") ;
	Integer pid = new Integer((int)p1.getProcessId()) ;
	foundTOs = root.find(atList(atProperty(".processId",
     pid), atDescendant(".class", ".text"))) ;
 
// This enables a Windows app with the provided window handle and returns a
// TestObject representing the window.
Long hWnd = getAppsHwnd();
foundTOs = root.find(atChild(".hwnd", hWnd, ".domain", "Win"));

// This enables a .NET app with the provided window handle and returns a
// TestObject representing the window.
Long handle = getAppsHwnd();
foundTOs = root.find(atChild("Handle", handle, ".domain", "Net"));

Feedback