Monday, 19 March 2012

Measuring Transaction Time In QTP

In some situations we may need to track the time taken for the script execution or need to track the time taken for a functionality to completed. For example, we can take a Networking application. Assume that we are running the discovery service to identify the list of devices available on the selected network. Here we need to measure the time taken to discover all the devices.


QTP provides a Utility object called "Services" which is used to measure the transaction time. Assume that we are going to track the Discovery service of a networking application.

'* Starting transaction Time
Services.StartTransaction "DiscoveryService"
'* Logic for Discovery Service goes here
'* Tracking End time
Services.EndTransaction "DiscoveryService" 

We can find StartTransaction and EndTransaction under Insert menu. We can also have n-number of transaction points in the same script. But we need to make sure that the tracking is happening properly,

We can also measure the time by using Timer function.Timer is VBScript in built function. We can take the same discovery service for example.

'* Starting transaction Time 
starttime= Timer '* It returns the time elapsed since 12 A.M mid night in seconds
'* Logic for Discovery Service goes here 
'* End transaction Time 
endtime = Timer
'* Calculating final time
finalfime = endtime- startrime

Here starttime,endtime,endtime are variables. We can use any variable based on the wish.

2 comments:

DevRabbit IT Solutions Inc. said...

Hello,
The Article on Measuring Transitions time in QTP is amazing give detail information the functionality of
QTP testing .Thanks for Sharing the informations about it. Software Testing Company

softwaretestsolutions said...

Thanks for your response as well as promoting your business!

Post a Comment

 
Back To Top