RIATest 2 Documentation Copyright © RIATest.com

Global Object

There is a unique global object, which is created before control enters any execution context. Methods and properties of Global object are accessible directory from script.

Methods

MethodDescription

assert

assert(argument)
Assert that argument evaluates to 'true'. Outputs verification passed or failed message to log. If assertion fails current script execution is aborted.

assertEqual

assertEqual(argument1,argument2)
Verify that argument1 strictly equals argument2. If arguments are not primitive types (e.g. are objects or arrays) all sub-components are verified to be equal as well (unlike == operator). Outputs verification passed or failed message to log. If assertion fails current script execution is aborted.

closeBrowser

openBrowser([browserProcessId]);
Close browser window. If specified process id appropriate browser will be killed otherwise last open browser will be killed.

fileGetContents

fileGetContents(fileName)
Read entire file contents as a string. File is assumed to be encoded in UTF-8. If file is not found or read error occurs null is returned.

filePutContents

filePutContents(fileName,contents)
Write specified contents string to specified file using UTF-8 encoding. If file exists its content is overwritten. Returns true if operation was successfull.

getEnv

getEnv(variable)
Get environment variable.

getProjectGlobal

getProjectGlobal(key)
Get the value from the project global value map corresponding to the specified key. Must be previously set by setProjectGlobal function.

getTimer

getTimer()
Return the time since startup of the execution in milliseconds.

getWaitTimeout

getWaitTimeout()
Returns current timeout value for waitFor operator in milliseconds.

isAppConnected

isAppConnected(appId)
Checks if the Application specified by its id is connected to RIATest.

isEqual

isEqual(argument1,argument2)
Strictly compare argument1 with argument2. If arguments are not primitive types (e.g. are objects or arrays) all sub-components are compared as well (unlike == operator). Returns true if arguments are equal.

isFinite

isFinite(argument)
Returns true if argument is finite number.

isNaN

isNaN(argument)
Returns true if argument is NaN.

isPresent

isPresent(locator)
Checks if the component specified by locator is present.

openBrowser

openBrowser(urlOrPath[, options]);
Open browser window and return process id of browser.
urlOrPath must specify url to application or file path to load in browser.
options is a bitwise or-ed mask of various flags.
Use BR_PROJECTLOADTYPE, BR_STANDALONE or BR_USELOADER to specify loading type. Use BR_RIATESTOPTION, BR_SYSDEFAULT, BR_IE, BR_FIREFOX, BR_CUSTOM to specify which browser to open.

parseFloat

parseFloat(string)
The parseFloat function produces a number value dictated by interpretation of the contents of the string argument as a decimal literal.

parseInt

parseInt(string,radix)
The parseInt function produces an integer value dictated by interpretation of the contents of the string (argument1) according to the specified radix (argument2). Leading whitespace in the string is ignored. If radix is undefined or 0, it is assumed to be 10 except when the number begins with the character pairs 0x or 0X, in which case a radix of 16 is assumed. Any radix-16 number may also optionally begin with the character pairs 0x or 0X.

pause

pause(argument)
Pauses execution of the script for specified number of milliseconds.

putEnv

putEnv(variable,value)
Set environment variable value.

selectApp

selectApp(appId)
Select Application for testing. appId must be string equal to id of Application. Returns true on success.

setProjectGlobal

setProjectGlobal(key,value)
Set value in the project global value map and associate it with the key. Project global value map is preserved during exection of the project (unlike plain global variables which persist only throughout single script execution.

setWaitTimeout

setWaitTimeout(argument)
Sets current timeout value for waitFor operator in milliseconds.

trace

trace(arguments,...)
Output argument value to message log

verify

verify(argument)
Verify that argument evaluates to 'true'. Outputs verification passed or failed message to log.

verifyEqual

verifyEqual(argument1,argument2)
Verify that argument1 strictly equals argument2. If arguments are not primitive types (e.g. are objects or arrays) all sub-components are verified to be equal as well (unlike == operator). Outputs verification passed or failed message to log.