Utility Functions and C Language Reference > Utility Functions: Scripting Languages (lr.) > Alphabetical Listing > lr.end_transaction


Marks the end of a transaction.


function lr.end_transaction(  transaction_name, status  )


Function lr.end_transaction(  transaction_name, status  )
Example: lr.end_transaction Transaction Functions


Name Comments
transaction_name A string indicating the name of an existing transaction.
status The Transaction Status

The lr.end_transaction function marks the end of a transaction and records the amount of time it took to perform the transaction. To indicate a transaction to be analyzed, place the lr.start_transaction function before the transaction, and the lr.end_transaction function after the transaction.

You can manually set the status of the transaction or you can allow the script to detect it automatically. To manually set the status, you perform a manual check within the code of your script (see example) evaluating the return code of a function. For the "succeed" return code, set the status to LR_PASS. For a "fail" return code, set the status to LR_FAIL. For an "aborted" return code, set the status to LR_STOP.

If status is LR_AUTO, then the value of status is automatically assigned. By default, this value is LR_PASS signifying a successful transaction.

If you make a series of calls to functions that modify the LR_AUTO status, then it is the last call before lr.end_transaction which effectively changes the status.

Return Values

On success, returns 0. Returns -1 if the transaction name is illegal or if there is no prior call to lr.start_transaction with a transaction of the same name.


Standard parameterization is not available for this function.