You are on page 1of 12

Where Value & Innovation co-exist

SilkTest 7.5
A Functionality & Regression Testing Tool

-SFQA Automation Team


Where Value & Innovation co-exist

Session – 3
 4Test Language
 Data Types
 Classes
 Method Calls
 Frequently Used Classes & Methods
 Scripting & Standards
 Enhanced Coding with examples (Manual Scripting)
 Snapfish – Sample Scripts
 Different error raising functions
 Linking Test Cases to Test Plans

October 14, 2008 2


Where Value & Innovation co-exist

Data Types (Most used)


 ANYTYPE  INTEGER
 ARRAY  LIST
 AGENTOPTION  RECT
• BOOLEAN  STRING
 BROWSERTYPE  TIME
 DATE, DATETIME  WINDOW
 FILETYPE  WINSTATE
 FILEMODE
 HDATABASE
 HFILE
 HMACHINE

Ex:
BROWSERTYPE btType
lbtType = {explorer4, netscape4}

October 14, 2008 3


Where Value & Innovation co-exist

Classes
The class indicates the type, or kind, of GUI object being declared. Note that this
is the 4Test class, not the class that the GUI itself uses internally.
 General Core Classes
 General Web Application Classes
 ActiveX/VB Classes
 Java Classes
 .Net Classes
 PowerBuilder Classes

October 14, 2008 4


Where Value & Innovation co-exist

Method Calls
A method is a routine that applies to a particular class of objects/window. Once an
object/window is declared, you can refer to it by its identifier when calling methods.

The following example calls the SetActive method on the Find dialog:
Find.SetActive () // Find is a Dialogbox and SetActive is a Method
Browser.Exists() // Browser is a window and Exists is a method

Frequently used methods:


9. SetActive() // for windows
10. SetText() // for textfields
11. DoClick() // for any object
12. GetText() // for textfields
13. Select() // for dropdown boxes, radiolists
14. Check() // for Check boxes
15. Uncheck() // for Checkboxes
16. Exists() // for any object and window
17. Waitforready() // for Browser
18. Pick() // for Menus

October 14, 2008 5


Where Value & Innovation co-exist

Scripting & Standards


 Organization of Code (functions, test cases, data)
 Include Files (Windows file)
 Include Files (Functions file)
 Test Script Files (.t and .g.t files)
 Test Plan Files (master and subplans concept)
 Suite Files
 Results (extracting and conversion of result to plan files)

 Hungarian notation
 Naming convention in which a variable’s name begins with one or more
lowercase letters indicating its data type. For example, the variable name
sCommandLine indicates that the data type of the variable is STRING.

October 14, 2008 6


Where Value & Innovation co-exist

Standards Cont..
 Variable prefixes
 Variables are specified in Hungarian notation, that is, prefixed with an
abbreviation for the data type. The data types and abbreviations are as
follows:
 anytype (a) semaphore (se)
 agentoption (ao) string (s)
 boolean (b) string or integer (si)
 datatype (dt) winstate (ws)
 guitype (gt) list of string (ls)
 handle (h) list of window (lw)
 integer (i) array of anytype (aa)
 number (n) array of string or integer (asi).
 real (r)
 rect (re)

October 14, 2008 7


Where Value & Innovation co-exist

Sample Script
Testcase testcase1.t
Testcase samples() appstate none
Integer iSum,iVal1,iVal2
iSum=0, iVal1=1,iVal2=2
while iSum<=10
iSum=iSum+iVal1+iVal2

Print iSum

October 14, 2008 8


Where Value & Innovation co-exist

Sample Scripts on Snapfish


 How to Invoke a Browser
 Verifying the Welcome Page
 Navigating to Login and Home Page
 Verifying the Photo Library Page
 Displaying all the links which are available in Log In Page
 Displaying all the images which are available in Log In Page

 Windows_training.inc
 Script_training.t

October 14, 2008 9


Where Value & Innovation co-exist

Different Error Functions


 LogError function

 Action: Logs an error message to the results file.


 Syntax: LogError (sMsg)

 LogWarning function

 Action:Logs a warning to the results file.


 Syntax:LogWarning (sWarning) Displays in purple color’

 AppError function
 Action: Places an error with the specified error message, proceeded by "***
Error:", into the results file.
 Syntax: AppError (sMessage)

October 14, 2008 10


Where Value & Innovation co-exist

 Raise statement
 Syntax: raise 1,”Navigation to Home Page is not displayed”

 Reraise statement
 Syntax: reraise

October 14, 2008 11


Where Value & Innovation co-exist

Thank you!

October 14, 2008 12

You might also like