background image
<< Overview - 4Test statements | Overview - The basic tools >>
Overview - 4Test code
<< Overview - 4Test statements | Overview - The basic tools >>
User's Guide
33
1 O
VERVIEW
The 4Test language
Example The following 4Test code shows how to use the if statement to
conditionally execute a method. The code picks the Close menu item from
the File menu of the Text Editor application, which causes a message box to
appear if there is unsaved work. The if statement tests for the existence of the
message box.
TextEditor.File.Close.Pick ()
if MessageBox.Exists ()
// if the message box exists
MessageBox.No.Click () // then dismiss it
Data types and variables
Built-in data types
4Test provides the following built-in data types:
For complete information about all 4Test data types, see the online Help.
C data types for DLL
functions
In addition to the 4Test data types, the following C data types are supported
for use in calling functions in DLLs.
The first two columns above show data types that correspond to the 4Test
INTEGER
data type. The third column corresponds to the
REAL
data type.
User-defined types
You can also create new data types, including enumerated types and records.
For example:
type FILE is LIST OF STRING
type COLOR is enum
red
green
Adding variables to a
testcase
In the following testcase a record data type is defined that contains each of
the data values the testcase needs. The methods in the testcase process fields
from the record instead of literal data values.
ANYTYPELIST
ARRAY
BOOLEAN
BROWSERTYPE
DATACLASS
DATATYPE
DATE
DATETIME
FONTSTYLE
GUITYPE
HANDLE
INTEGER
LIST
LONG
NUMBER
REAL
SEMAPHORE
SET
STRING
TABLECOL
TABLEROW
TIME
WINDOW
char
int
short
long
unsigned char
unsigned int
unsigned short
unsigned long
float
double