Measuring transactions

Relevant for: GUI tests only

You can measure how long it takes to run a section of your test by defining transactions. A transaction represents the process in your application that you are interested in measuring. Your test must include transactions to be used by LoadRunner, Performance Center, or the Business Process Monitor. These products use only the data that is included within a transaction, and ignore any data in a test outside of a transaction.

You define transactions within your test by enclosing the appropriate sections of the test with start and end transaction statements. For example, you can define a transaction that measures how long it takes to reserve a seat on a flight and for the confirmation to be displayed on the client's terminal.

During the run session, the StartTransaction step signals the beginning of the time measurement. The time measurement continues until the EndTransaction step is reached. The test results for the EndTransaction step include the transaction's name, end status, total duration, and wasted time.

During a run session, UFT runs background processes that add to the time it takes to run a test. Wasted time is the time within the total duration that was added as a result of UFT running the transaction. If the application ran the transaction without UFT, the total duration would equal the total duration minus the wasted time.

Note: If you start a transaction while there is already open transaction with the same name, the previous transaction is ended with Fail status and then the new transaction is started.

There is no limit to the number of transactions that can be added to a test.

Additionally, you can:

  • Insert a transaction within a transaction.

  • Insert a variety of transaction-related statements using the Step Generator or Editor. For details, see the Services object topic in the UFT Object Model Reference for GUI Testing.

  • Enter Start Transaction and End Transaction steps using UFT. For details, see Start Transaction Dialog Box and End Transaction Dialog Box.

Example: Part of a sample test with a transaction is shown below, as it is displayed in the Keyword View:

The same part of the test is displayed in the Editor as follows:

Services.StartTransaction "ReserveSeat"
Browser("Welcome: Mercury Tours").Page("Find a Flight: Mercury").WebList("fromPort").Select "London"
Browser("Welcome: Mercury Tours").Page("Find a Flight: Mercury").WebList("toPort").Select "Frankfurt"
Browser("Welcome: Mercury Tours").Page("Find a Flight: Mercury").WebList("toDay").Select "12"
Browser("Welcome: Mercury Tours").Page("Find a Flight: Mercury").WebRadioGroup("servClass").Select "Business"
Browser("Welcome: Mercury Tours").Page("Find a Flight: Mercury").WebList("airline").Select "Blue Skies Airlines"
Browser("Welcome: Mercury Tours").Page("Find a Flight: Mercury").Image("findFlights").Click 65,12
Browser("Welcome: Mercury Tours").Page("Select a Flight: Mercury").WebRadioGroup("outFlight").Select "Blue Skies Airlines"
Browser("Welcome: Mercury Tours").Page("Select a Flight: Mercury").WebRadioGroup("inFlight").Select "Blue Skies Airlines"
Browser("Welcome: Mercury Tours").Page("Select a Flight: Mercury").Image("reserveFlights").Click 46,8
Services.EndTransaction "ReserveSeat"