background image
<< Trackbar appears in the TestTip | Chapter 15 Testing PowerBuilder Applications >>
<< Trackbar appears in the TestTip | Chapter 15 Testing PowerBuilder Applications >>
Enhancing Object Recognition of Java Components
Enhancing Object Recognition of Java Components
14-17
7. Click OK to complete the verification point.
Enhancing Object Recognition of Java Components
Robot uses recognition methods to identify components in the
application-under-test. These recognition methods are saved as arguments in scripts
so Robot can correctly identify these component during playback. For example,
Robot can identify a Java Button by the visible text displayed on the button. If the
text changes after the script has been recorded, the script may fail when it is played
back.
The best way to make sure that Robot recognizes a Java component is to assign a
name to the object in the Java code. Although Java supports several ways of doing
this, Robot works as follows:
þ
If the component exports a
public String getName()
method and this
method returns a name that starts with a dot (.) character, Robot uses this name
to uniquely identify the component. The dot prefix is necessary to make sure
that the name has been explicitly set by the user and not set to a default value by
the browser.
This recognition method is available with all java.awt.Component derived
classes.
þ
If the component contains an
accessibleContext.accessibleName
property, Robot will use it to recognize the component.
This recognition method is available only with JFC-derived classes.
By assigning unique names to your Java components, you can make your scripts
more resilient.
NOTE: When you create an Object Properties verification point, you can
edit the list of properties that are saved with the component. Robot saves the
list relative to the Java class name (for example, Java.awt.Button), not the
Robot command name (for example, PushButton). This allows you to save
derived classes with different lists of properties. For more information about
adding and removing properties from the properties list, see the Robot Help.