Forum Discussion

official_raghu's avatar
official_raghu
Occasional Contributor
12 years ago

Capturing milliseconds' difference between events

Hi,



We are involved in performance testing of a .net application, wherein we need to find the time gap between the start and end of an event. We are using aqDateTime.Now at the start and end of the events and measuring the difference. However, there are some events which happen within the time span of a second, and we are unable to capture the time gap between the start and end. Is there a technique / provision in TestComplete to capture the time gap between events in millisecocnds? I request the pros to kindly enlighten me on this...
  • Well, I lied, I didn't search properly first :)



    The solution for VBScript looks like this




    Dim tFrom, tTo, tDif


      


      tFrom = Timer


      aqUtils.Delay 100


      tTo = Timer


      tDif = Int((tTo-tFrom) * 1000)


      Log.Message tDif

  • simon_glet's avatar
    simon_glet
    Regular Contributor
    Hi Raghu,



    Have you checked out HISUtils.StopWatch ? It mesures to the millisecond.



    Ref here.



    Sincerely
  • karkadil's avatar
    karkadil
    Valued Contributor
    Well, I lied, I didn't search properly first :)



    The solution for VBScript looks like this




    Dim tFrom, tTo, tDif


      


      tFrom = Timer


      aqUtils.Delay 100


      tTo = Timer


      tDif = Int((tTo-tFrom) * 1000)


      Log.Message tDif

  • karkadil's avatar
    karkadil
    Valued Contributor
    In JScript you can use the following example:




      var dateFrom = new Date();


      aqUtils.Delay(100);


      var dateTo = new Date();


      var dif = dateTo.getTime() - dateFrom.getTime();


      Log.Message(dif);



    However, I haven't found anything similar in VBScript

  • official_raghu's avatar
    official_raghu
    Occasional Contributor
    Hi Simon, Alexei, Gena,



    Many thanks for  your responses. Simon, we've found that HISUtils.StopWatch and its methods are best suited for our purposes. Thanks again for that.



    Raghu