Share this page

lr.

# lr.startTransaction

Marks the beginning of a transaction.

JavaScript Transaction Example | Transaction Functions

## Syntax

    lr.startTransaction( transactionName  );

## Arguments

Argument | Comments
--- | ---
transactionName | The name of the transaction.

The lr.startTransaction function marks the beginning of a transaction. To indicate a transaction to be analyzed, use the lr.startTransaction and lr.endTransaction functions. These functions are inserted immediately before and after the transaction.

Transactions can be nested, but each lr.startTransaction statement must be associated with an lr.endTransaction statement or it will be interpreted as an illegal command.

Note: For information on allowed characters and maximum length for transaction names, see Transaction guidelines in the Virtual User Generator Help Center.

## Return Values

This function returns -1 if the transaction name is illegal.

## Parameterization

Parameterization is not applicable to this function.

## Example

Copy code

    function Action(){

       lr.startTransaction("deposit");

       /* Server API call */
       rc = bank_deposit (50);

       /* End transaction with operation result - pass or fail */
       if (rc == 0)
           lr.endTransaction("deposit", lr.PASS);
       else
           lr.endTransaction("deposit", lr.FAIL);

       return 0;
    }

Tips to improve your search results... VuGen Function Reference Version 26.1-26.3 Function Reference 26.1-26.3 All View Local Help Center View Online Help Center Version: