Measuring transactions

Relevant for: GUI tests only

Define transactions to measure the length of time it takes to run a specific section of your test.

For example, you might want to define a transaction that measures the length of time required to add a specific item to your shopping cart.

Define transactions in your test

Define transactions within your test by enclosing the appropriate sections of the test with Start and End transaction statements.

Define as many transactions as you need in your test, or even nested transactions, as follows:

Insert transaction-related statements

Use the Step Generator or the Editor to insert a variety of transaction-related statements.

For details, see the Services object topic in the UFT One Object Model Reference for GUI Testing.

Enter StartTransaction and EndTransaction steps

Use the Start and End Transaction dialog boxes. For details, see:

Note: Ensure that you only have one transaction open at a time with the same name.

If you have a transaction open, and then open a second transaction with the same name as the first, the first transaction will first end with a Fail status before the second transaction starts.

Back to top

Transactions in your run session

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.

Wasted time is the time within the total duration that was added as a result of UFT One running the transaction, including any processes that UFT One runs in the background.

Back to top

Transactions for UFT One integrations

You must define transactions when integrating your test with LoadRunner Professional, LoadRunner Enterprise, or the Business Process Monitor.

These products use only the data included within a transaction, and ignore any data in a test outside of a transaction.

Back to top

Sample transaction

The following image displays a sample test and transaction, as displayed in the Keyword View:

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

Services.StartTransaction "AddtoCart"
Browser("Advantage Shopping").Page("Advantage Shopping").Link("TabletsCategory").Click
Browser("Advantage Shopping").Page("Advantage Shopping").Image("fetchImage?image_id=3200").Click
Browser("Advantage Shopping").Page("Advantage Shopping").WebElement("rabbit").Click
Browser("Advantage Shopping").Page("Advantage Shopping").WebElement("WebElement").Click
Browser("Advantage Shopping").Page("Advantage Shopping").WebButton("save_to_cart").Click
Services.EndTransaction "AddtoCart"

Back to top