Facebook

For any corporate training requirements Please mail To sudhakar@qtpsudhakar.com
Course Name Date Time Duration Type Location
An important update from QtpSudhakar. I stopped giving classroom training in MindQ Systems. I have bigger plans and I want to put an end to regular classroom training because very less people are practicing. From now onwards every session of mine is going to have explanation and practice. Everyone should practice in presence of mine and should go out of classroom with practical knowledge. So I started my own institute AnyTechLabs in Madhapur. Please reach out to +91-8328152362 for course details. Visit AnyTechLabs.com for address details.
Selenium + Cucumber 24th October 7.30 AM IST to 9.00 AM IST 45 Days WeekDay Online

A book "Cracking the QTP interview" authored by Sudhakar.Read More. Buy From FlipKart

Thursday, September 2, 2010

Mercury Timers Object - The QTP StopWatch

'###############################################
'           Mercury Timers & Timer Object 
'###############################################

'Purpose - To Create a Timer which will work like a stop watch

'We can create multiple Timers using Mercury Timers Object.
'Every Timer can be controlled by Timer Object
' It has some facilities to start, stop, continue and reset the Timers

MercuryTimers("Timer1").Start 'Start measuring time using Timer1. 

Wait 1 

MercuryTimers("Timer1").Stop 'After one second, stop Timer1. 

MercuryTimers("Timer2").Start 'Start measuring time usingTimer2. 

'Two seconds later, restart Timer1 (which will continue to measure time from
'the time it stopped while Timer2 continues uninterrupted). 

Wait 2 

MercuryTimers("Timer1").Continue 

'Three seconds later, stop both timers and send a report to the test
'results specifying the elapsed time for each of the timer objects
'(Timer1 ~4000 ms; Timer2 ~5000 ms). 

Wait 3 

Reporter.ReportEvent micInfo, "Elapsed Time", "Timer1: " & MercuryTimers("Timer1").Stop() & "ms, Timer2: " & MercuryTimers("Timer2").Stop() & "ms" 

'Set a transaction manually for each of the timer objects. Convert the 
'elapsed time for each of the timer objects from milliseconds to seconds so
'the elapsed time will be reported correctly in the transaction. 

Services.SetTransaction "Timer1",MercuryTimers("Timer1").ElapsedTime / 1000,Pass 

Services.SetTransaction "Timer2",MercuryTimers("Timer2").ElapsedTime / 1000,Pass 

No comments :

Post a Comment