Creates a completed transaction.


function lr.set_transaction(  name, duration, status  )


Function lr.set_transaction(  name, duration, status  ) 
Example: Transaction Duration, set_transaction, and waste timeTransaction Functions


NameA name for the transaction.
durationTransaction duration in seconds.
statusThe transaction completion status. One of the Transaction Status constants for pass, fail, or stop. The auto status is not applicable.

The lr.set_transaction function creates a transaction, its duration, and status in a single call. Use it where the business process you want to capture in a transaction does not consist of sequential steps, or where you may or may not want to create a transaction, depending on conditions that are known only during the test.

To create a transaction for non-sequential steps, capture the duration of each series of steps that participate in the business process. Sum the durations and create the transaction with lr.set_transaction.

lr.set_transaction can also be used to report the duration of a failed transaction by saving the duration before the transaction fails with lr.get_transaction_duration then using lr.set_transaction to create a new transaction for reporting that time.

lr.set_transaction creates and closes the transaction. Therefore, no functions that work only on open transactions are applicable.

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

Return Values

This function returns LR_PASS (0) on success, and LR_FAIL (1) on failure.


All string input arguments can be passed using standard parameterization.