|
IBM Rational Functional Tester Version 8.1.1000 IBM Rational Functional Tester API Reference Project Version 2.3 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.rational.test.ft.object.interfaces.TestObject com.rational.test.ft.object.interfaces.ClientTestObject com.rational.test.ft.object.interfaces.RootTestObject
public class RootTestObject
The RootTestObject
represents a global view of the system being tested.
It does not represent an actual TestObject
in the software under test, but rather it provides access to system-wide functionality, such as
finding an arbitrary TestObject
based on properties, location, or getting the
DomainTestObject
.
Field Summary |
---|
Fields inherited from class com.rational.test.ft.object.interfaces.TestObject |
---|
ref |
Method Summary | |
---|---|
void |
emitLowLevelEvent(LowLevelEvent event)
Plays back a low level event. |
void |
emitLowLevelEvent(LowLevelEvent[] events)
Plays back a sequence of low level events. |
boolean |
enableForTesting(int processId)
Enables the process with processId for testing. |
boolean |
enableForTesting(long windowHandle)
Enables the process with window windowHandle for testing. |
boolean |
enableForTesting(java.lang.String processName)
Enables the process(es) with name processName for testing. |
boolean |
exists()
The RootTestObject is always available. |
TestObject[] |
find(Subitem properties)
Finds all candidates that match given search criteria. |
TestObject[] |
find(Subitem properties, boolean mappableOnly)
Finds all candidates that match the given search criteria. |
DomainTestObject[] |
getDomains()
Returns an array of all the domains that can be tested in the system. |
static RootTestObject |
getRootTestObject()
Gets the RootTestObject . |
IScreen |
getScreen()
Returns an interface to the screen object. |
java.awt.image.BufferedImage |
getScreenSnapshot()
Takes a snapshot (screen capture) of the entire desktop |
java.awt.image.BufferedImage |
getScreenSnapshot(java.awt.Rectangle rect)
Takes a snapshot (screen capture) of the specified portion of the desktop |
java.awt.image.BufferedImage |
getScreenSnapshot(java.awt.Rectangle rect, boolean clipToVisibleArea)
Takes a snapshot (screen capture) of the specified portion of the desktop * |
java.awt.image.BufferedImage |
getScreenSnapshot(java.awt.Rectangle rect, java.lang.String fname)
Takes a snapshot (screen capture) of the specified portion of the desktop If a custom imaging solution is provided, a temporary file name with full path should be passed. |
static ScreenTestObject |
getScreenTestObject()
|
IWindow[] |
getTopWindows()
Returns an array of IWindows . |
GuiTestObject |
objectAtPoint(java.awt.Point screenPt)
Returns a GuiTestObject for the object at the specified screen location. |
Methods inherited from class com.rational.test.ft.object.interfaces.ClientTestObject |
---|
find, findAndInvoke, findAndInvokeProxy, invoke, invokeProxy, unregister, waitForExistence |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Method Detail |
---|
public static RootTestObject getRootTestObject()
RootTestObject
.
public static ScreenTestObject getScreenTestObject()
public boolean exists()
RootTestObject
is always available. This method always
returns true
.
exists
in class ClientTestObject
ClientTestObject
public GuiTestObject objectAtPoint(java.awt.Point screenPt)
GuiTestObject
for the object at the specified screen location.
public IScreen getScreen()
public IWindow[] getTopWindows()
IWindows
. The IWIndow
interface provides access to the native
windowing layer. This method is never recorded.
Any script that uses this method will likely be platform specific.
If there are no top windows (an unlikely situation), a zero-length array is returned.
public DomainTestObject[] getDomains()
public TestObject[] find(Subitem properties)
atProperty
- A name/value pair representing a TestObject
property.
atChild
- Contains one or more properties that must be matched
against the direct child of the starting TestObject
.
atDescendant
- Contains one or more properties that can be matched
against any child of the starting TestObject
.
atList
- Used to specify a sequential list of properties to match against.
Subitems that are valide for atList
are:
atChild
atDescendant
atProperty
RootTestObject
find, including:
.processName
- As a top-level property this has two functions:
.processId
- As a top-level property this has two functions:
.domain
- Only search in top-level domains matching the .domain
property.
.hWnd
- along with the hWnd property being used for the search, if the .domain
"Win" is also specified the matching window will be enabled for testing.
Handle
- along with the window handle property being used for the search, if the .domain
"Net" is also specified the matching window will be enabled for testing.
TestObject[] foundTOs ;
RootTestObject root = RootTestObject.getRootTestObject() ;
// This finds all top-level windows in the Windows domain with caption "My Document".
CaptionText caption = new CaptionText("My Document") ;
foundTOs = root.find(atChild(".domain", "Win", ".caption", caption)) ;
// This finds any dialogs and returns 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"))) ;
// This starts Notepad, dynamically enables that process, finds its toplevel window that
// matches the process id, and gets 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"));
find
in class TestObject
properties
- The property set to match against.ClientTestObject.unregister()
,
RationalTestScript.unregister(Object[])
,
RationalTestScript.unregisterAll()
,
RationalTestScript.getRegisteredTestObjects()
public TestObject[] find(Subitem properties, boolean mappableOnly)
atProperty
- A name/value pair representing a TestObject
property.
atChild
- Contains one or more properties that must be matched
against the direct child of the starting TestObject
.
atDescendant
- Contains one or more properties that can be matched
against any child of the starting TestObject
.
atList
- Used to specify a sequential list of properties to match against.
Subitems that are valide for atList
are:
atChild
atDescendant
atProperty
RootTestObject
find, including:
.processName
- As a top-level property this has two functions:
.processId
- As a top-level property this has two functions:
.domain
- Only search in top-level domains matching the .domain
property.
.hWnd
- along with the hWnd property being used for the search, if the .domain
"Win" is also specified the matching window will be enabled for testing.
Handle
- along with the window handle property being used for the search, if the .domain
"Net" is also specified the matching window will be enabled for testing.
TestObject[] foundTOs ;
RootTestObject root = RootTestObject.getRootTestObject() ;
// This will 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)) ;
// This will 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"))) ;
// This will start Notepad, dynamically enable that process, find its toplevel 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"));
find
in class ClientTestObject
properties
- The property set to match against.mappableOnly
- Whether to search all children or just mappable childrenClientTestObject.unregister()
,
RationalTestScript.unregister(Object[])
,
RationalTestScript.unregisterAll()
,
RationalTestScript.getRegisteredTestObjects()
public boolean enableForTesting(java.lang.String processName)
processName
for testing.
processName
- the name of the process(es) to enable.public boolean enableForTesting(int processId)
processId
for testing.
processId
- the pid of the process to enable.public boolean enableForTesting(long windowHandle)
windowHandle
for testing.
windowHandle
- the handle of a window in the process to enable..public void emitLowLevelEvent(LowLevelEvent event)
TestObject
. These actions
are further broken down into more basic parts, so rather than something like TestObject.click()
which is comprised of a move, a mouse button down, and a mouse button up, you deal with each of those
sub actions individually.
event
- the LowLevelEvent
to be played back.SubitemFactory.keyDown(String)
,
SubitemFactory.keyUp(String)
,
SubitemFactory.leftMouseButtonDown()
,
SubitemFactory.leftMouseButtonUp()
,
SubitemFactory.middleMouseButtonDown()
,
SubitemFactory.middleMouseButtonUp()
,
SubitemFactory.rightMouseButtonDown()
,
SubitemFactory.rightMouseButtonUp()
,
SubitemFactory.mouseMove(Point)
,
SubitemFactory.mouseWheel(int)
,
SubitemFactory.delay(int)
,
LowLevelEvent
public void emitLowLevelEvent(LowLevelEvent[] events)
TestObject
. These actions
are further broken down into more basic parts, so rather than something like TestObject.click()
which is comprised of a move, a mouse button down, and a mouse button up, you deal with each of those
sub actions individually.
events
- the array of LowLevelEvents
to be played back.SubitemFactory.keyDown(String)
,
SubitemFactory.keyUp(String)
,
SubitemFactory.leftMouseButtonDown()
,
SubitemFactory.leftMouseButtonUp()
,
SubitemFactory.middleMouseButtonDown()
,
SubitemFactory.middleMouseButtonUp()
,
SubitemFactory.rightMouseButtonDown()
,
SubitemFactory.rightMouseButtonUp()
,
SubitemFactory.mouseMove(Point)
,
SubitemFactory.mouseWheel(int)
,
SubitemFactory.delay(int)
,
LowLevelEvent
public java.awt.image.BufferedImage getScreenSnapshot()
public java.awt.image.BufferedImage getScreenSnapshot(java.awt.Rectangle rect)
rect
- The portion of the screen to capturepublic java.awt.image.BufferedImage getScreenSnapshot(java.awt.Rectangle rect, boolean clipToVisibleArea)
CoordinateOffScreenException
rect
- The portion of the screen to captureclipToVisibleArea
- If true, the method will consider only visible portion of the screen, otherwise throws CoordinateOffScreenException.public java.awt.image.BufferedImage getScreenSnapshot(java.awt.Rectangle rect, java.lang.String fname)
rect
- The portion of the screen to capture
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |