Share this page

# Example: lr.end_transaction

## Example 1 - Simple Transaction

The sample below illustrates timing the duration of a method call getStockList. The sample code does not check for exceptions.

    lr.start_transaction("GetStocks");
    orStockServer1.getStockList();
    lr.end_transaction ("GetStocks", lr.PASS);

## Example 2 - Conditional transaction sample

The sample below illustrates timing the duration of the same sample code, however it adds checks for exceptions and ensures that the getStockList() method returns an non-zero length array.

    Dim Stocks as String
    lr.start_transaction"GetStocks"
    On Error GoTo ErrorHandler
    Stocks = getStockList()
    if len(Stocks)= 0 then
        lr.end_transaction "GetStocks", lr.FAIL
        lr.message "No stocks returned"
    else
        lr.end_transaction "GetStocks", lr.PASS
    end if
    lr.message "Pass"
    Action = lr.PASS
    Exit Function

    ErrorHandler:
        Action = lr.FAIL
        lr.message "Fail"

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