background image
<< Test Cases - a script file | Test Cases - Recording 4Test components >>
Test Cases - How recorded commands uniquely identify GUI objects
<< Test Cases - a script file | Test Cases - Recording 4Test components >>
138
User's Guide
5 D
ESIGNING
AND
R
ECORDING
T
ESTCASES
How recorded commands uniquely identify GUI objects
How recorded commands uniquely identify GUI objects
Fully qualified
identifiers
When you record testcases, SilkTest uses the window declarations in the test
frame file to construct a unique identifier, called a fully qualified identifier,
for each GUI object. The fully-qualified identifier consists of the identifier of
the object, combined with the identifiers of the object's ancestors. In this way,
the 4Test commands that are recorded can manipulate the correct object when
you run your testcases.
If all identifiers were unique, this would not be necessary. However, because
it is possible to have many GUI objects with the same identifier (for example,
the ever-present OK pushbutton), a method call needs to specify as many of
the object's ancestors as are required to uniquely identify it.
The following table shows how fully qualified identifiers are constructed:
The fully qualified identifier for main windows and dialogs does not need to
include ancestors because the declarations begin with the keyword window.
Recording without window declarations
If you record a testcase against a GUI object for which there is no declaration
(or if you want to write a testcase from scratch against such an object),
SilkTest requires a special syntax to uniquely identify the GUI object because
there is no identifier.
Dynamic instantiation
This special syntax is called a dynamic instantiation and is composed of the
class and tag of the object. For example, if there is not a declaration for the
Find dialog of the Text Editor application, the syntax required to identify the
object looks like this:
MainWin("Text Editor|$D:\MYPROGS\TEXTED2.EXE").DialogBox("Find")
GUI object
Fully-qualified identifier
Example
Main Window The main window's identifier TextEdit.SetActive ()
Dialog
The dialog's identifier
Find.SetActive ()
Control
The identifiers of the dialog
and the control
Find.Cancel.Click ()
Menu item
The identifiers of the main
window, the menu, and the
menu item
TextEditor.File.Open.Pick ()