
Star Quality 4Test Coding Guidlines
Revised: 08-29-05 blesuer
Capitalization:
- DataTypes are always all uppercase.
Examples: STRING, INTEGER.
- UnderScores are used in DataTypes that are multiple words.
Examples: MY_ENUM, MY_RECORD.
- Hungarian notation is used for all variable names. The first letter
of a variable name is the first letter(s) of its type. The first letter
for user defined types is ‘u’.
Examples: sUserName, iLoopCounter, lsProperties, uEmployeeData.
- Method and Function names begin with an uppercase letter. Each
Significant letter is capitalized.
Naming Conventions:
- Use the const SCRIPTROOT to reference the path to 4Test scripts. If
multiple directories are used, make those references relative to
SCRIPTROOT.
- The method used to invoke a window is called “Invoke”.
- The method used to close a window is called “Close”.
- The method used to accept a dialog is called “Accept”
- Method and Function symbols in the QA Organizer testplan should have
the same name as their 4Test counterpart.
Coding Conventions:
- Functions and Methods that do not return values should be given the
return type VOID.
- All methods and functions should end with a return statement even if
it is VOID.
- All while loops that watch for a GUI event to terminate include a
second expression/counter to prevent infinite loops.
Example:
iLoop = 1
While !MyWindow.Exists && iLoop < 60
...
iLoop++
- All switch statements have a default case, which may raise an error
if no cases are matched.
- Use the 4Test style of the ‘for loop’ rather than the C-style.
- Place reusable functions in a file called myapp_funcs.inc.
- Pathnames are never hard-coded. Instead use the SCRIPTROOT
environment variable.
Example: const DATA_DIR = SCRIPTROOT\data
- All “included files” are listed in a file called usefiles.inc. The
main frame file for the application under test includes the statement
‘use “usefiles.inc”’
- Include a single space between a method name and its argument list.
There is no space between the parenthesis and the first and last
arguments.
Example: VOID Invoke (STRING sPath)
- Non-trivial code is commented. Comments should also be included for
any variable names that are not intuitively obvious.
- If the except part of a do .. except is empty, a comment should be
included to explain the logic.
- he optional message parameter in the Verify statement is always
included to better explain the error condition being generated.
Window Declaration Standards:
- Use multitags only where necessary. Always disable the feature from
options/recorder.
- Objects are named as they are rendered in the application under test
unless the name is ambiguous or long. In those cases, a clear, concise
name can be substituted.
- Group child controls in a window declaration by object class. Within
the class, order the controls as they appear on the screen from upper
left to lower right.
- Move declarations for classes of controls that are not expected to
be used to the bottom of the parent’s window declaration, e.g.
StaticText.
- Members variables and are placed at the top of a window declaration
after the tag and parent statements. Methods are placed next followed by
declarations for child windows.
- Sort the declarations for container windows including DialogBox,
ChildWin, BrowserChild alphabetically in the declarations include file.
|