This page is maintained for older versions of Rapise only. The latest documentation can be found at:
Defining Functions

Defining Functions

Top  Previous  Next



The Rapise test script is in Javascript.  You may define as many Javascript functions as you would like to call from your test script.



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.


test files dialog, user script

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:

object tree dialog user functions



In an External File

You can define your function in another file and include it.


For example:

function Test()


      // Withdraw is defined inside the "Test" function

      function Withdraw(amount)


              Log("Start Withdraw of:"+amount);

              // Withdraw logic is here





      // Include "UtilityFunctions.js" to get at function Deposit()


      // Deposit is defined in "UtilityFunctions.js"




See Also

To learn more about what the Script Recorder will change in your test script, see Multiple Recordings.