background image
<< Porting Tests - Supporting GUI-specific executables | Porting Tests - Supporting extra controls >>
Porting Tests - Supporting GUI-specific captions
<< Porting Tests - Supporting GUI-specific executables | Porting Tests - Supporting extra controls >>
272
User's Guide
13 P
ORTING
T
ESTS
TO
O
THER
GUI
S
Supporting GUI-specific captions
You should declare as many sCmdLine variables as there are GUIs on which
your application runs, beginning each declaration with the appropriate GUI
specifier.
For example, the following constants specify how SilkTest should start the
Text Editor application on Windows and Macintosh:
msw const sCmdLine = "c:\sample\texted2.exe"
mac const sCmdLine = "{SYS_GetDrive ()}:Text Editor:TextEd2"
Supporting GUI-specific captions
Introduction
Recall that SilkTest, by default, bases the tag for an object on the object's
actual caption or label. If the captions or labels change when the application
is ported to a different GUI, you have two options:
·
You can have multiple tags, each based on the platform-specific caption
or label.
·
You can have a single tag, using the index form of the tag, as long the
relative position of the object is the same in the ported versions of the
application.
Then, in your testcases, you can use the same identifier to refer to the object
regardless of what the object's actual label or caption is.
Creating GUI-specific
tags
To close a file on the Macintosh, you select File/Quit, whereas on all other
platforms you select File/Exit. The following window declaration accounts
for these differences with two tag statements:
MenuItem Exit
tag "Exit"
mac tag "Quit"
With this declaration, the Exit identifier can be used to refer to the menu item
regardless of the actual label.
Using the index as the
tag
If you are certain that an object's position in relation to its sibling objects of
the same class will remain the same when the application is ported, you can
use the index form for the tag.
Repeating the example from the preceding section, because the Exit/Quit
menu item is the fifth menu item on the File menu (on all platforms), you can
use the index form for the tag (#5) as shown here:
MenuItem Exit
tag "#5"