Share this page

# lr.end_transaction

Marks the end of a transaction.

## C#

    void lr.end_transaction( string transaction_name, int status);

## VB.NET

    Sub lr.end_transaction( ByVal transaction_name As String, ByVal status As Integer )

Transaction Functions

## Arguments

Name | Comments
--- | ---
transaction_name | The name of an open 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.

## Return Values

No value returned.

## Parameterization

You cannot use standard parameterization for any arguments in this function.

## Example

The following example marks the end of a transaction, and assigns it the appropriate status.

Copy code

    public int login(string username, string password)
    {
    //emulate failed login
    return lr.FAIL;
    }
    int status = login("username","password");

    if (status == lr.FAIL) {
     lr.end_transaction("Transaction",lr.FAIL);
    }
    else
     lr.end_transaction("Transaction",lr.PASS);

    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: