Skip to content

Defining Functions


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

In User.js

It is recommended to put all user functions into User.js file available in any test from its creation.

test files, 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 view 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.