background image
<< Porting Tests - Changing the window declaration of the control | Porting Tests - SGetGUIType function >>
Porting Tests - Supporting differences in application behavior
<< Porting Tests - Changing the window declaration of the control | Porting Tests - SGetGUIType function >>
User's Guide
277
13 P
ORTING
T
ESTS
TO
O
THER
GUI
S
Supporting differences in application behavior
.
Find.Dismiss ()
Note that the script does not indicate that anything unusual is happening; all
of the steps necessary to make the Select method work properly, regardless of
the class of the object, are encapsulated in the class and window declarations.
Supporting differences in application behavior
Introduction
Although you can account for differences in the appearance of your
application in the window declarations, if the application's behavior is
fundamentally different when ported, you need to modify your testcases
themselves. To modify your testcases, you write sections of 4Test code that
are platform-specific, and then branch to the correct section of code using the
return value from the GetGUIType built-in function.
This section first shows how to use the GetGUIType function in conjunction
with the if and the switch statements. It then presents some examples of
common implementation differences.
GetGUIType function
The GetGUIType function returns the current GUI. It is a matter of personal
preference whether you test the return value from the function in an if
statement or a switch statement. You typically use a switch statement when
there are more than two logic branches.
For example, suppose a feature is implemented one way on the Macintosh,
but a second way on all other platforms:
if (GetGUIType () != mac)
// test feature on all platforms but Macintosh
else
// test feature on Macintosh
If your application is deployed on multiple platforms, and each platform
implements the same feature slightly differently, you would probably want to
use the switch statement in a construction like the following:
switch (GetGUIType ())
case mac:
// code to test feature on macintosh
case mswdos:
// code to test feature on windows
case motif:
// code to test feature on motif