background image
<< Test Frame - SetLineNum method | Test Frame - Modifying the message box declaration >>
Test Frame - Defining a data structure for an object
<< Test Frame - SetLineNum method | Test Frame - Modifying the message box declaration >>
User's Guide
99
4 R
ECORDING
A
T
EST
F
RAME
Defining a data structure for an object
Where to define the
method
When you include a method definition in a GUI object's window declaration,
you can only use the method on that one object. If you want to define a
method that you can use on all GUI objects of a given class, you should
define the method at the class level. For more information, see "Adding
methods to a class" on page 306.
Defining a data structure for an object
As you design your testcases, you may want to associate data with individual
objects, which can then be referenced inside testcases. You may find this
preferable to declaring global variables or passing parameters to your
testcases.
The type of data you decide to define within a window declaration will vary,
depending on the type of testing you are doing. Some examples include:
The default value that you expect the object to have when it displays
The tab sequence for each of a dialog box's child objects
Example: a dialog's
tab sequence
The following declaration for the Find dialog contains a list that specifies the
tab sequence of the dialog's children.
window DialogBox Find
tag "Find"
parent TextEditor
LIST OF WINDOW lwTabOrder = {...}
FindWhat
CaseSensitive
Direction
Cancel
For more information about the syntax to use for lists, see "LIST data type"
in online Help.
Use the member-of
operator to access
data
Use the member-of operator ( . ) to reference the data defined in a window
declaration. For example, if a script needs to know which control should have
focus when the Find dialog (declared in the preceding example) is first
displayed, it can access this data from the window declaration with this
expression:
Find.lwTabOrder[1]
Similarly, to set focus to the third control in the list:
Find.lwTabOrder[3].SetFocus ()