TestObjects の検索

Functional Tester では、指定した検索条件と一致する 1 つ以上の TestObjects を探索する方法がサポートされています。 探索対象の 1 つ以上の TestObject のプロパティーを表す名前/値のペアに基づいて、検索が行われます。 検索は、グローバルに行うこともでき、親 TestObject の子に制限することもできます。

Functional Tester は、テスト対象のソフトウェアのグローバル・ビューを表す RootTestObject をサポートしています。 一括検索を実行するには、RootTestObject に関する検索メソッドを呼び出します。 TestObject 検索メソッドを呼び出すと、TestObject の子のみ検索されます。

検索メソッドの最初の引数は、検索プロパティーの副項目です。2 つ目のオプション引数は、テスト・オブジェクト・マップに組み込まれている子のみ検索する必要があるかどうかを示すフラグです。プロパティーの副項目の有効な値は以下のとおりです。

RootTestObject.find に適用される特殊なプロパティーは、以下のとおりです。

例:

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"));

フィードバック