Transaction Functions in Loadrunner

Transaction Functions

There are different category of loadrunner functions available in Vugen. Below are the most important loadrunner functions used.

lr_end_sub_transaction :

  • lr_end_sub_transaction function marks the end of a sub-transaction.
  • Insert these functions immediately before and after the sub-transaction steps.

lr_end_transaction :

  • lr_end_transaction function marks the end of a transaction and records the amount of time it took to perform the transaction.
  • It has LR_Fail, LR_Pass, LR_stop and LR_Auto Status.
  • So,you can manually set the status of the transaction according to your need.

lr_end_transaction_instance :

  • lr_end_transaction_instance function marks the end of a transaction instance and records the amount of time it took to perform the transaction.
  • It has LR_Fail, LR_Pass, LR_stop and LR_Auto Status.
  • So, you can manually set the status of the transaction according to your need.

lr_fail_trans_with_error :

  • lr_fail_trans_with_error function sets the default exit status to LR_FAIL for all open transactions with LR_AUTO in their lr_end_transaction statement and sends an error message.
  • The message is sent to the output window or log file.
  • It has LR_Fail, LR_Pass, LR_stop and LR_Auto Status.
  • You can manually set the status of the transaction according to your need.

lr_get_trans_instance_duration :

  • lr_get_trans_instance_duration function returns the duration of an open transaction instance in seconds until this point.
  • It was used to determine the total transaction time before the transaction has ended.
  • lr_get_trans_instance_duration returns values greater than zero only for open transactions.

lr_get_trans_instance_wasted_time :

  • lr_get_trans_instance_wasted_time function returns the Wasted Time of the specified transaction until this point.
  • lr_get_trans_instance_think_time function returns values greater than zero only for open transactions.

lr_get_transaction_duration :

  • lr_get_transaction_duration function returns the duration in seconds of the specified transaction to this point.
  • It will returns the duration including Wasted Time.

lr_get_transaction_think_time :

  • lr_get_transaction_think_time function returns the think time of the specified transaction until this point.
  • It returns values greater than zero only for open transactions.

lr_get_transaction_wasted_time :

  • lr_get_transaction_think_time function returns the think time of the specified transaction until this point.
  • It returns values greater than zero only for open transactions.

lr_resume_transaction :

  • lr_resume_transaction function resumes the reporting of transaction data within the script that was suspended by lr_stop_transaction.

lr_resume_transaction_instance :

  • lr_resume_transaction_instance function resumes the reporting of transaction data within the script that was suspended by lr_stop_transaction_instance.
  • If lr_resume_transaction_instance is not called, the final results reflect the statistics only until the call to lr_stop_transaction_instance.

lr_set_transaction_instance_status :

  • lr_set_transaction_instance_status function sets the status of the open transaction with the transaction handle trans_handle.
  • The handle was returned by lr_start_transaction_instance.

lr_set_transaction_status :

  • 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.

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.
  • It creates and closes the transaction.

lr_set_transaction_status_by_name :

  • lr_set_transaction_status_by_name function sets the default status of the open transaction with name trans_name.
  • Transaction's lr_end_transaction statement must use automatic status assignment by passing LR_AUTO as its status parameter.
  • Transaction's status is defined in the status parameter of lr_end_transaction.

lr_start_sub_transaction :

  • lr_start_sub_transaction function marks the beginning of a sub-transaction.
  • Sub-transactions are used for isolating parts of a business process.
  • Multiple sub-transactions can be nested within a parent transaction.
  • A sub-transaction may also be a parent to a smaller sub–transaction.

lr_start_transaction :

  • lr_start_transaction function marks the beginning of a transaction.
  • Transactions can be nested, but each lr_start_transaction statement must be associated with an lr_end_transaction statement or it will be interpreted as an illegal command.

lr_start_transaction_instance :

  • lr_start_transaction_instance function marks the beginning of a transaction instance. A
  • Transaction instance is an occurrence of a transaction with transaction_name.
  • Instances are identified by their handle which distinguishes them from other instances of the same transaction.
  • So the function returns the handle of the transaction instance which identifies the instance.

lr_stop_transaction :

  • lr_stop_transaction, statistics returned by the "get" Transaction Functions reflect only the data up to the call, until lr_resume_transaction is called.
  • The specified transaction must have been opened with lr_start_transaction.
  •  lr_resume_transaction is not called, the "get" functions and the final results reflect only the duration from the transaction start to the lr_stop_transaction call.
  • Thus, lr_stop_transaction and lr_resume_transaction can be used conditionally to collect information either about an entire transaction, or only the beginning.
  • To accomplish this, call lr_resume_transaction only if your condition is met.

lr_stop_transaction_instance :

  • lr_stop_transaction_instance, statistics returned by the "get" Transaction Functions reflect only the data up to the call, until lr_resume_transaction_instance is called.
  • The specified transaction instance must have been opened with lr_start_transaction_instance.
  • If lr_resume_transaction_instance is not called, the final results reflect the statistics only until the call to lr_stop_transaction_instance.
  • Therefore, lr_stop_transaction_instance and lr_resume_transaction_instance can be used to conditionally collect information about either the beginning, or all of the transaction.

lr_wasted_time :

  • lr_wasted_time allows you to subtract the time wasted on incidental or secondary actions from all open transactions.

Click Here to see all the run time function present in loadrunner.

One thought on “Transaction Functions in Loadrunner

Leave a Reply

Your email address will not be published. Required fields are marked *