Monday, March 14, 2011

What are QTP transactions?

This is a rarely discussed topic in QTP. I would like to give an overview of what it is and how to use it in QTP.

A transaction represents the process in your application that you are interested in measuring. By defining a transaction you can measure how long it takes to run a section of a test script.

Need for Transactions:
Transactions can be used to measure the performance of the script
By analyzing the output of the Transaction we can optimize the script in certain areas

Defining a Transaction:

You define transactions within your test by enclosing the appropriate sections of the test with start and end transaction statements. During the test run, the StartTransaction step signals the beginning of the time measurement.

The time measurement continues until the EndTransaction step is reached.

The test report displays the time it took to perform the transaction. Below is an example test report (Click on the image to enlarge it)

QTP Transactions
QTP Transactions in the result.


Services.StartTransaction "ReserveSeat"
'Sets the Transaction timer on

Services.EndTransaction "ReserveSeat" 
'Ends the transaction timer

'The result can be seen in the test report

QTP sample scripts can be found here.


  1. can we access resulted transaction time during run time instead of result viewer?

  2. No. for that we can use Timer function available in vbScript


Please leave your comment here...