Having problems with your account or logging in?
A lot of changes are happening in the community right now. Some may affect you. READ MORE HERE

Are there any coding guidelines for the SilkTest 4Test language?

Are there any coding guidelines for the SilkTest 4Test language?

The following are suggested 4Test standards that can be implementedfor all published material, including documentation, courseware, and consultingwork.

Terminology

Elements in a LIST are called

items

Elements in a list object (ComboBox, ListBox, PageList, RadioList) are called

items

Members of a record are called

fields


Style

Data types are denoted in all capital letters.

STRING

LIST OF WINDOW

User-defined types are denoted in all capital letters. Underscores are used between words.

type LANGUAGE is enum

type NEW_EMPLOYEE is record

type COLUMN is INTEGER, STRING

Constants are denoted in all capital letters. Underscores are used between words.

const CREATE = TRUE

const APP_EXEC = "c:\foo\foo.exe"

The booleans true and false are denoted in all capital letters.

TRUE

FALSE

The null value is denoted in all capital letters.

NULL

The first and all significant letters of built-in and user-defined functions, methods, and properties are capitalized.

ListCount ()

GetSelText ()

MyNewFunction ()

Caption

Hungarian notation is used for naming variables

STRING sFile

INTEGER iCount

LIST OF WINDOW lwChildren

Data driven functions preface the testcase name with DataFor.

DataForTestCaseName ()

A single space precedes an opening parenthesis (expect for dynamic instantiation). No space follows the opening parenthesis.

MyApp.GetChildren ()

MainWin("My App").DialogBox("Open").GetCaption ()

w.SetText ("foo")

A single space separates function parameters.

ListInsert (lList, 4, "new item")

testcase Foo (wDialog, "Open", FALSE)

A single space separates operators.

for i = 1 to 50

The boolean expression in the if statement is enclosed in parenthesis.

if (sFirstVar == sSecondVar)

The ! operator is outside the parenthesis.

if !(bExists)


Methods

Dialog boxes have a standard set of methods.

Invoke, Close

Method names for custom objects which emulate standard functionality are the same as the built-in methods.

wCustomEditControl.SetText ("foo")

wCustomPageList.Select ("Tab One")


Comments

A single space follows a comment designation.

// bring up the app

The first letter of a comment is lowercase.

// check that field has correct value

Comments inside of functions are indented along with the statement being described. Comment sections are separated with a blank line.

MyFunc ()

// bring up the app

MyApp.Invoke ()

// populate the field

MyApp.Date.SetText ("01/01/1996")

// verify date is correct

MyApp.Date.VerifyValue ("01/01/1996")

File headers include the file name, brief description of the contents, author and date. A separator line delimits the header section from the body of the file.

// frame.inc

//

// Window declarations for My App.

//

// Written by Testy Software, April 96

//

//***********************************************

 

DISCLAIMER:

Some content on Community Tips & Information pages is not officially supported by Micro Focus. Please refer to our Terms of Use for more detail.
Top Contributors
Version history
Revision #:
1 of 1
Last update:
‎2013-02-15 19:24
Updated by:
 
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.