Script and
TestCase Reporting Functions
Chaining Scripts
Global Variables
Related Functions
Setting
and Getting Test Variables
Setting and Getting Environmental
Variables
Popup
Related Functions
Error
Handling Related Functions
Map
File Related
Window
Related Functions
Locale Related
Functions
Invoking Other Scripts/Applications
Other General Functions
Script and TestCase Reporting Functions
 |
Any script results can be reported to QEngine reports using these functions.
|
reportTestCase
Function
Description:
To display the test case status (passed
or failed) in the test case report.
How
to Define:
reportTestCase(caseid,result,remarks,severity)
caseid
= ID to be displayed in the reports.
result
= 0-passed ; 1-failed
remarks
= Remarks to be displayed in the reports.
severity
= Severity of the case.
Example:
result=selectCheckInfo("department_1","selecteditems","Sales")
if result == 0:
reportTestCase("tstStatus",0,
"SelectCheckInfo Passed")
else:
reportTestCase("tstStatus",1,
"SelectCheckInfo Failed","Critical")
Return Values:
-NA-
Top
reportStatus
Function
Description:
To display user defined status in the
script reports.
Status Id
is user defined; any value can be specified for identification.
result
can be 0 or 1 only. 0 for Success and 1 for Failure.
remarks
can be any textual comment to be displayed in the reports.
How
to Define:
reportStatus("Status Id",
result, remarks)
statusid
= ID to be displayed in teh reports.
result
= 0-passed ; 1-failed
remarks
= Remarks to be displayed in the reports
Example:
result=getRowCount("Employee N")
if result == 5:
reportStatus("rowcnt",0, "Row
count is Correct")
else:
reportStatus("rowcnt",1,
"Invalid Row count")
Return Values:
-NA-
Top
Chaining Scripts
 |
These functions used to call an existing script in the suite from another script in the same suite.
|
callScript
Function
Description:
Invoke another web script from the one
currently being executed.
For more details refer "Chaining the Scripts".
How
to Define:
callScript("Web Script
Name","Web Script Path")
Mandatory Parameters:
WebScriptName = Script name to be called.
WebScriptPath = Script path (relative to
the web scripts directory).
Example:
callScript("test","case1/test")
Return Values:
Whether script execution successfully
completed or not
Top
callScriptUpto
Function
Description:
Invoke another web script from the one
currently being executed.
Execute up to the line number specifed
For more details refer "Chaining the Scripts".
How
to Define:
callScriptUpto("Web Script Name","Web Script Path",
Line number)
Example:
callScriptUpto("test","case1/test",75)
Return Values:
Whether script execution successfully
completed or not.
Top
Global Variable Functions
 |
These functions used to store and access the variables from one script to other script during runtime.
|
setGlobal
Function
Description:
To set the value for the global variable.
How
to Define:
setGlobal("<variable_name>","<variable_value>")
Example:
setGlobal("qehome","file:\\C:\test\WebTest\QEngineWebTest\examples\payrollsystem\index.html")
Return Values:
-NA-
Top
getGlobal
Function
Description:
To get the value for the global variable.
How
to Define:
getGlobal("<variable_name>")
Example:
getGlobal("qehome")
Return Values:
String
Top
Setting and Getting Test
Variables
 |
These functions useful to set a script variable in to test variable for testcase to access it during run time.
|
setTestVariable
Function
Description:
To set test variable name and value. The
test variables can be used for parameterization of attribute values in
element or table checkpoints in a test case.
How
to Define:
result =setTestVariable("<variable_name>","<variable_value>")
Example:
result =setTestVariable("var1","test")
displayMessage(result)
Return Values:
NA
Top
getTestVariable
Function
Description:
To get the value stored in a
test variable. This is local to the
script and cannot be used across scripts.
How
to Define:
result =getTestVariable("<variable_name>")
Example:
result =getTestVariable("var1")
displayMessage(result)
Return Values:
String
Top
Setting
and getting Environmental Variable
 |
These functions useful to dynamically change the environment variables during run time.
|
setEnvironmentalVariable
Function
Description:
To set a value in a
environment variable. This is global to the
suite and can be used across scripts.
How
to Define:
setEnvironmentalVariable("<variable_name>","<variable_value>")
Example:
setEnvironmentalVariable("var1","val1")
Return Values:
NA
Top
getEnvironmentalVariable
Function
Description:
To get the value stored in a
environmental variable. This is
global to the
script and can be used across scripts.
How
to Define:
result =getEnvironmentalVariable("<variable_name>")
Example:
result =getEnvironmentalVariable("var1")
displayMessage(result)
Return Values:
String - Environmental variable value
Top
Popup
Related Functions
 |
The popup
functions are not applicable for the child browser windows invoked from
the launched browser window and modal/modeless
dialogs invoked from the launched browser window.
|
Note:
getPopUpText
Function
Description:
To read the text message displayed in the
popup.
How
to Define:
result =getPopUpText("<window_name>","<wait_time>"))
Example:
result =getPopUpText("AdventNet",6)
displayMessage(result)
Return Values:
String
Top
getUnExpectedPopUpTitle
Function
Description:
During playback, if any popup that was
not encountered during recording, appears then it is called unexpected
popup and you can read the title of the popup using this function.
How
to Define:
result =getUnExpectedPopUpTitle()
Example:
result =getUnExpectedPopUpTitle()
displayMessage(result)
Return Values:
String
Top
closeUnExpectedPopUp
Function
Description:
During playback, if any popup that was
not encountered during recording, appears then it is called unexpected popup
and you can close the same using this function.
How
to Define:
closeUnExpectedPopUp("Window
Title",timeout)
Example:
result =closeUnExpectedPopUp(result,2)
Return Values:
0 for Success
1 for Failure
Top
doesPopupExists
Function
Description:
To check whether the popup with the
specified title exists during playback.
How
to Define:
doesPopupExists("Title")
Example:
result =doesPopUpExists("AdventNetPayrollSystem")
Return Values:
0 for Success
1 for Failure
closePopUp
Function
Description:
To close the popup with the specified
title during playback.
How
to Define:
closePopUp("Title")
Example:
result =closePopUp("AdventNetPayrollSystem")
Return Values:
0 for Success
1 for Failure
Error Handling Related
Functions
 |
These functions enables / disables the error handling script and changes the error handling script in run time.
|
setErrorHandlingScript
Function
Description:
To define the error handling script in
the runtime during playback. This can be called from any script to
enable specific error handling. Apart from enabling error handling in
the suite settings, you can also set error handling script from the
webscript under playback.
How
to Define:
setErrHandlingScript("SCRIPT_NAME","SCRIPT_PATH")
Example:
setErrorHandlingScript("error_script","error_script")
Return Value:
0 for Success
1 for Failure
disableErrorHandling
Function
Description:
To disable error handling during
playback.
How
to Define:
disableErrorHandling()
Return Value:
0 for Success
1 for Failure
Map File Related
Functions
 |
These functions used to handle Map files during playback.
|
useMapFile
Function
Description:
To use the map file present anywhere in
the system and load the element properties.
How
to Define:
useMapFile(Path_To_Map_File)
Example:
useMapFile("./conf/common.map")
Return Value:
0 for Success
1 for Failure
Window Related
Functions
 |
These functions used to control browser window during playback.
|
minimizeWindow
Function
Description:
To minimize the active browser window
during playback.
How
to Define:
minimizeWindow()
Return Value:
0 for Success
1 for Failure
Top
maximizeWindow
Function
Description:
To maximize the active browser window
during playback.
How
to Define:
maximizeWindow()
Return Value:
0 for Success
1 for Failure
Top
Locale Related
Functions
 |
These functions used to set the locale during playback.
|
changeLocale
Function
Description:
To dynamically modify the localized
language in the recorded script.
How
to Define:
changeLocale(language, country)
Example:
changeLocale("ab(Abkhazian)","AF(Afghanistan)")
Return Values:
0 for Success
1 for Failure
Top
getLocaleLanguage
Function
Description:
Returns the selected locale language.
How
to Define:
getLocaleLanguage()
Return Value:
String indicating the selected language
such as "ab(Abkhazian)"
Top
getLocaleCountry
Function
Description:
Returns the selected locale country.
How
to Define:
getLocaleCountry()
Return Value:
String indicating the selected country
such as "AF(Afghanistan)"
Top
getLocalizedString
Function
Description:
Returns the localized string for the
given key.
How
to Define:
getLocalizedString("String").
String is the property name in the map file.
Return Value:
String
Top
Invoking Other Scripts/Applications
 |
These functions used to invoke the script file present in the system.
|
invokeApplication
Function
Description:
Invoke any application (.exe, .bat etc)
running in the system.
Current script execution will be
suspended till the called Application is executed completely.
How
to Define:
invokeApplication("Command line")
Example:
invokeApplication("C:/Mozilla/Mozilla.exe")
Note:
Use forward slash for all path separators in your command.
Return Values:
0 for Success
1 for Failure
Top
invokeApplicationInThread
Function
Description:
Invoke any application (.exe, .bat etc)
running in the system.
Called Application will be started on new
thread. Calling script's execution will continue
How
to Define:
invokeApplicationInThread("Command line")
Example:
invokeApplicationInThread("C:/Mozilla/Mozilla.exe")
Note:
Use forward slash for all path separators in your command.
Return Values:
0 for Success
1 for Failure
Top
Other General Functions
saveLogs
Function
Description:
Saves the test execution logs with the
specified file name. Saves the test execution logs in <QEngine_ Home
> / projects / <Suite Name> / weblogs
/<Month>_<Date>_<Hour>_<Minutes> directory.
How
to Define:
saveLogs("<LogFileName>")
Example:
saveLogs("mymodulelogs")
Return Values:
-NA-
Top
displayMessage
Function
Description:
To display user defined message in the
logs
How
to Define:
displayMessage("Message to be
displayed")
Example:
displayMessage("Result = "+var)
Return Values:
-NA-
Top
wait
Function
Description:
To pause the script execution for n
seconds.
How
to Define:
wait(seconds)
Example:
wait(5)
Return Values:
-NA-
Top
setFastMode
Function
Description:
Using this function
the playback mode can be changed in runtime, so that, the playback mode
can be adjusted during script playback.
How
to Define:
setFastMode("boolean")
Example:
setFastMode("true")
- Enable the
fast play mode. The script actions will ignore the think time recorded
in the scripts.
Return Values:
-NA-
Top
setDownloadTimeLimit
Function
Description:
To change the default time (default value
- 60 seconds) to wait for page download. This function will wait until
the document ready state is reached. If the document ready state is
reached even before the given time then the control will automatically
move to execute the next line in the script.
How
to Define:
setDownloadTimeLimit(seconds)
Example:
setDownloadTimeLimit(5)
Return Values:
-NA-
Top
saveScreenShot
Function
Description:
When any error is encountered during the
execution of the webscript, the snapshot of the client screen can be
taken using this function.
The screen shot will be saved in the file
whose name is specified as the first argument. The file will be saved
under <QEngine
Home/projects/<suite name>/webreports/screenshots folder.
This will happen after the n seconds
specified as waittime.
How
to Define:
saveScreenShot("filename",waittime)
Example:
saveScreenShot("a",10)
Return Values:
0 for Success
1 for Failure
Top
stop
Function
Description:
To stop the execution of the webscript.
If this function is used in a child script which is getting called from
a parent script using the callScript(), then stop() will stop the
execution of both the child and the parent script.
How
to Define:
stop()
Example:
stop()
Return Values:
0 for Success
1 for Failure
Top
stopAll
Function
Description:
This function will stop the execution of
script for the particular suite.
How
to Define:
stopAll()
Example:
stopAll()
Return Values:
0 for Success
1 for Failure
Top
skipScriptExecution
Function
Description:
This will skip the script execution for
the script with the specified name.
How
to Define:
skipScriptExecution("<Script_Name>")
Example:
skipScriptExecution("test-for-construct")
Return Values:
0 for Success
1 for Failure
Top
getScriptName
Function
Description:
This will return currently executing
scriptname.
How
to Define:
getScriptName()
Return Values:
String - Currently running script name.
Top
fireMouseOver
Function
Description:
To invoke the onMouseOver action on the
HTML object over which the mouse pointer is placed.
How
to Define:
fireMouseOver("Object ID",
timeout)
With
Dynamic Property
fireMouseOver("Object ID",
timeout,"Property","value")
Mandatory
Parameters :
Object
ID = Generated by QEngine.
Optional
Parameters :
Property
= Property name to be overwritten with dynamic value.
Value
= Dynamic value of the property name specified.
Example:
fireMouseOver("link1",2)
With
Dynamic Property
fireMouseOver("link1",2,"innertext","link2")
If the innertext of "link" has changed to
"links", then you can use the same function by overwriting the value of
innertext as above.
Return Values:
0 for Success
1 for Failure
Top
getBrowserType
Function
Description:
To get the browser type (IE, Mozilla or
FireFox) on which currently playing back.
How
to Define:
No
Parameters.
Example:
getBrowserType()
Return Values:
String - Browser type as string.
Top
getBrowserVersion
Function
Description:
To get the browser version on which
currently playing back.
How
to Define:
No
Parameters.
Example:
getBrowserVersion()
Return Values:
String - Browser version as string.
Top
getOSVersion
Function
Description:
To get the OS version of the machine in
which you are replaying the script.
How
to Define:
No Parameters.
Example:
getOSVersion()
Return Values:
String - OS version as string.
Top
getOSName
Function
Description:
To get the OS Name (Windows or Linux) of
the machine in which you are replaying the script.
How
to Define:
No
Parameters.
Example:
getOSName()
Return Values:
String - OS name as string.
Top
writeToCSVFile
Function
Description:
To write CSV values in the specified csv
file.
How
to Define:
writeToCSVFile("File Name","Data",
"Append To File")
Here,
"File Name"
is the CSV file name (do not specify the path, since QEngine creates
and stores the csv files in <QEngine_Home>/projects/<Suite_Name>/dataset
directory), "Data" is a
string array which contains the values to be written in the specified
CSV file and "Append
To File" is by
default false which overwrites the CSV file, if already exists. If set
to true, appends the contents in the existing csv file
Example:
writeToCSVFile("test.csv","result_array","true")
Return Values:
-NA-
Top
getEncryptedValue
Function
Description:
To encrypt the input text. This will be
useful in cases where you read the data from a CSV file and set it in
the password field.
How
to Define:
getEncryptedValue("text")
Example:
E.g. to set the encrypted password value
retrieved from csv file in the loop.
initCSV ("C:\a.csv")
for i in range (0,4)
setwindow ("windowID",timeout)
username = getCSVValueAt(i,1)
password = getCSVValueAt(i,2)
encryptedPassword = getEncryptedValue
(password)
setText ("usernamefieldID",username,
timeout)
setText ("passwordfieldID",
encryptedPassword, timeout)
clickButton ("buttonID",timeout)
setWindow ("windowID",timeout)
clickLink("logoutlinkID",timeout)
Return Values:
Encrypted text value as string.
Top
getLastError
Function
Description:
To get the script error (if any) in the
last script statement that was executed before calling the getLastError
().
How
to Define:
getLastError()
Example:
result =getLastError()
displayMessage(result)
Return Value:
tring.
Top
waitForPageDownload
Function
Description:
This function waits until the document
ready state is reached or until the value specified for Maximum waittime for document ready
in Play Settings option is timed out.
How
to Define:
waitForPageDownload()
Return Value:
0 for Success
1 for Failure
Top
submitForm
Function
Description:
To submit a form for the given form name.
How
to Define:
submitForm(formName, waittime)
Example:
submitForm("payroll", 2)
Return Value:
0 for Success
1 for Failure
Top
clearCookies
Function
Description:
To clear the cookies of the specified domain
How
to Define:
clearCookies("domain_name")
Example:
clearCookies("zoho.com", 2)
Return Value:
0 for Success
1 for Failure
clearCache
Function
Description:
To clear Cache of the browser window.
How
to Define:
clearCache( )
Example:
clearCache( )
Return Value:
0 for Success
1 for Failure