Examples you can use
This proxy sample explains how to extend the recording behavior of a control with SubItems and support for the corresponding playback.
Extended Capabilities: Recording controls with SubItems
This proxy sample extends the processSingleMouseEvent()
proxy API to
modify the recording behavior of a spin control. Although a spin control has two buttons and
one text control as its children, from a testing perspective it must be treated as a single
control with no children appearing in the TestObject Map. (In the TestObjectMap, the buttons
and the text are treated as SubItems.) The processSingleMouseEvent()
implementation sets methods with suitable SubItems, for example
atButton("UP")
or atButton("DOWN")
as parameters for
recording. Also note that although there are child objects for the spin control, you must
make sure they are not listed as separate TestObjects. Therefore, the
getChildAtPoint()
and getChildren()
APIs are extended to
return null values. These child objects are treated as SubItems.
Playback Support
To support playback for each SubItem that is introduced during
recording, Rational® Functional Tester looks for the screen
rectangle for each SubItem through the proxy. The SubItem rectangle can be provided by
extending java.awt.Rectangle getScreenRectangle(Subitem subitem)
proxy
API.
Deploy the binaries
Copy the JSpinnerProxy.jar
and JSpinnerProxy.rftcust
files to the customization directory and restart Rational® Functional Tester to test the sample
application-under-test (AUT).
Verify the recording behavior
- Before you deploy the proxies, when you record results of the up and down buttons of
JSpinner, the clicks are recorded as
button.click()
, where each up and down control is treated as a separate control. - After you deploy the proxies, clicking on the up button is recorded as
spinner().click(atButton("UP"))
. Notice that the buttons are treated and recorded as SubItems and not as separate TestObjects.
Verify the playback behavior
- Before you deploy the proxies, playing back user actions with SubItems, for example
spinner().click(atButton("UP"))
throws an exception,Point not found
. - After you deploy the proxies, playing back user actions with SubItems work fine.