Ask a Question

How to get execution time between two events?

narender_1
Contributor

How to get execution time between two events?

Hi,

    I want to measure the time between two operation in a script using testComplete. For example, if I pressed search button then how much time it is taking to give search result. The application is a desktop application and the result will be displayed in the same window.





Thanks,

Nmanne
1 REPLY 1
ecrespo
Occasional Contributor

Hi Narender,



I think you could either use the StopWatch object if you have the HISUtils plug-in or use the aqDateTime object.



In the first case:

funcion Test()

{

    var stpWatch = HISUtils.StopWatch;

    StopWatch.Start();

    MySearchOperation();

    StopWatch.Stop();

    Log.Message ("Difference in times: " + StopWatch.ToString());

}



In the second case:

function Test()

{

    var startTime = aqDateTime.Time();

    MySearchOperation();

    var stopTime = aqDateTime.Time();

    var diffTime = aqDateTime(startTime, stopTime);

    //Difference in times (Days:Hours:Minutes:Seconds)

    Log.Message( aqConvert.TimeIntervalToStr(diffTime));

}



For more specifics, please check TestComplete help.
cancel
Showing results for 
Search instead for 
Did you mean: