Using transactions

You can insert transactions into your scripts to measure performance for a specific process or task.

Transaction overview

You define transactions to measure the performance of the server. Each transaction measures the time it takes for the server to respond to specified Vuser requests. These requests can be simple tasks such as waiting for a response for a single query, or complex tasks, such as submitting several queries and generating a report.

To measure a transaction, you insert Vuser functions to mark the beginning and the end of a task. Within a script, you can mark an unlimited number of transactions, each transaction with a different name.

For LoadRunner Professional, Controller measures the time that it takes to perform each transaction. After the test run, you analyze the server's performance per transaction using the Analysis' graphs and reports.

Before creating a script, you should determine which business processes you want to measure. You then mark each business process or sub-process as a transaction.

You can create transactions either during or after recording.

Back to top

Insert a transaction while recording

You use the VuGen Recording toolbar to insert a transaction while recording a Vuser script.

To Do this
Mark the start of a transaction

On the Recording toolbar, click the Start Transaction button , enter a transaction name, and click OK.

When the script is generated, it includes an lr_start_transaction statement.

Mark the end of a transaction

On the Recording toolbar, click the End Transaction button and select the transaction to close.

When the script is generated, it includes an lr_end_transaction statement.

Back to top

Insert a transaction after recording

You use VuGen's Editor to insert a transaction after recording a Vuser script.

To Do this
Mark the start of a transaction

Locate the cursor in the script where you want to start the transaction and do one of the following:

  • Select Design > Insert in Script > Start Transaction.
  • Press Ctrl+T.
  • Right-click in the script where you want to start the transaction and select Insert > Start Transaction.

An lr_start_transaction function is inserted into the Vuser script. Enter a transaction name into the new step.

Mark the end of a transaction

Locate the cursor in the script where you want to end the transaction and do one of the following:

  • Select Design > Insert in Script > End Transaction.
  • Press Ctrl+Shift+T.
  • Right-click in the script where you want to end the transaction and select Insert > End Transaction.

An lr_end_transaction function is inserted into the Vuser script. Enter a transaction name into the new step.

Simultaneously mark the start and end of a transaction
  1. Select the steps that you want to include in the transaction.
  2. Do one of the following:

    • Select Design > Insert in Script > Surround with Transaction.
    • Press Shift+Ctrl+I.
    • Right-click inside the selection and select Surround with Transaction.

    The Surround with Transaction dialog box opens.

  3. Enter a name for the transaction and click OK.

An lr_start_transaction function is inserted before the first selected step, and an lr_end_transaction function after the last selected step.

Back to top

Transaction guidelines

  • You can create nested transactions—transactions within transactions. If you nest transactions, close the inner transactions before closing the outer ones—otherwise the transactions cannot be analyzed properly. Nested transactions must be contained within a single action section.

  • A failed transaction does not automatically set the script's Replay status to Failed.
  • Transaction names:

    • Must be unique.
    • Have a maximum length of 256 characters.
    • Must contain only printable characters, which can be any combination of letters, numbers, and punctuation marks.

Back to top

See also: