|Top Previous Next|
There are two ways to maintain additional functions: (1) Inside your test script and (2) in an external file.
Inside your Test Script
Define the function inside of one of the following functions: Test(), TestInit(), TestFinish(), or TestPrepare(). The Script Recorder will erase code placed outside of these functions.
Inside *.user.js File
It is recommended to put all user functions into <testname>.user.js file available in any test from its creation.
This file is automatically attached into every script. All variables and functions defined in it may be used in the test. User-defined functions are also available under the "User Functions" node in the Object Tree:
In an External File
You can define your function in another file and include it.
// Withdraw is defined inside the "Test" function
Log("Start Withdraw of:"+amount);
// Withdraw logic is here
// Include "UtilityFunctions.js" to get at function Deposit()
// Deposit is defined in "UtilityFunctions.js"