background image
<< Test Frame - Mapping and recording Manager Class OSF/Motif widgets | Test Frame - SetLineNum method >>
Test Frame - Defining a method for a GUI object
<< Test Frame - Mapping and recording Manager Class OSF/Motif widgets | Test Frame - SetLineNum method >>
User's Guide
97
4 R
ECORDING
A
T
EST
F
RAME
Defining a method for a GUI object
To enable the recording of these declarations, map the Custom Class of the
Ignore class widget onto itself. For example, to "un-ignore" the class
XmForm, enter XmForm in both the Custom Class and Standard Class
windows of the Class Map dialog.
You can also use Class Mapping to add custom windows to the Ignore class.
Specifying how a dialog is invoked
Two ways to invoke
4Test provides two equivalent ways to invoke a dialog:
·
Use the Pick method to pick the menu item that invokes the dialog, as in:
TextEditor.File.Open.Pick ()
·
Use the Invoke method, as in:
Open.Invoke ()
While both are equivalent, using the Invoke method makes your testcases
more maintainable. For example, if the menu pick changes, you only have to
change it in your window declarations, not in any of your testcases.
The Invoke method
To use the Invoke method, the declaration for the dialog needs to specify the
dialog's wInvoke variable, which contains the identifier of the menu item or
button that invokes the dialog. For example:
window DialogBox Open
tag "Open"
parent TextEditor
WINDOW wInvoke = TextEditor.File.Open
Defining a method for a GUI object
If you need to perform an action on an object, and the class does not provide
a method for doing so, you can define your own method in the window
declaration for the object. Then, in your scripts, you can use the method as
though it were just another of the class's built-in methods. You can hand-code
methods or record them.
Procedure To record a method:
1
Position the insertion point on the declaration of the GUI object you want
to add a method to.
2
Select Record/Method.
The Record Method dialog displays.