MercuryTimers Object:

‘**********************************************************************************************
'Mercury Timers Object
'Purpose - To Create a Timer which will work like a stop watch 
‘**********************************************************************************************

Public Function funcClickOnLink()

          '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 10
           
          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 20
           
          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 30
         
          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

End Function
‘**********************************************************************************************

No comments:

Post a Comment