cancel
Showing results for 
Search instead for 
Did you mean: 

Indicator Timer

Indicator Timer

My Test Complete execution normally takes more than a Hour or so. Hence in the Indicator popup if we have the timer which will display the HH : MM : SS running.

 

This will help us to know approx. when it will end or knowing other stuffs wrt timings.

 

I'm expecting something like below,

 

Indicator_Timer.png

13 Comments
Super Contributor

I like the suggestion. +1 from me.

 

Community Hero

Ditto on the idea... although, you could potentially do something like that already... if you combine a Timer object, the HISUtils.StopWatch object, and methods on the Indicator object, you could probably hack together a really cool little thingie to do exactly what you want.

 

Actually... you've inspired me... currently, the timer object is not available in script extensions... so that would have to be something handled in code... HOWEVER... the Indicator object IS available... as is the aqDateTime object... so, combing those into an Indicator pop/push set, called by a timer in your project, could do the same thing...

Give me a few free hours, I might even code something like that. Smiley Happy

Community Hero

OK... message me if you want the actual extension file.

Basically, the implementation is like so...

First, in your project, create a simple wrapper function somewhere to call the timer object method.  The reason being is that timer objects cannot call script extension methods directly.  Something like this:

function timerExecution() {
    IndicatorTimer.updateIndicatorTimer();
}



 

Next, at the beginning of your project, make the following call:

 

 

    IndicatorTimer.projectStartTime = aqDateTime.Now();

This initializes the timer at the start of your project run so we can get the elapsed time.

Then, create your timer:

    myTimer = Utils.Timers.Add(1000, 'Unit1.timerExecution', true);

And boom... there ya go... every second now, the Indicator will update to include a formatted text showing hours, minutes, and seconds of elapsed time.

You can even include at the end of your project a line like:

Log.Message('Overall elapsed time = ' + aqConvert.DateTimeToFormatStr(IndicatorTimer.projectElapsedTime, '[%H:%M:%S]'));

One caveat that I haven't found a work around for...

The indicator gets updated a LOT during a test run... especially with "WaitNNN" calls and the like.  Anytime the indicator gets updated like that, it blows away the time text in the indicator... however, all you have to do is wait a second or so and it will show up again.  You could also decrease the timer interval from 1000 to 100... every 10th of a second then we'll update the indicator.  This seems to do pretty well but I'm not sure about performance overhead.

Again... let me know if you want the extension... 

 

jhe
Occasional Visitor

How to get the extension for this? Looks helpful.

Community Hero

@jhehere is the discussion link you can get it from.

jhe
Occasional Visitor

@Shankar_ - does the extension work on TC version 12? Have installed it I guess in the right path. I'm trying to enable it but not seeing it in Install Script extensions.

Community Hero

Yes, the extension works on TC version 12.

Where did you put the file for use?  It should go in your TestComplete 12\bin\Extensions\ScriptExtensions folder.  If you put it there, try opening File | Install Script Extensions and click the "reload" button to see if it comes up.


jhe
Occasional Visitor

I have it copied in the exact path you mentioned. However, going to File > Install Script Extensions and click reload button didn't work. Not seeing anything new but the pre-installed extensions. I have also tried restarting TC.

Community Hero

Hrm... something is wrong with the packaged TCX... let me debug and I hope to have a new version ready for download soon

 

Community Hero

Well... that was embarassing... apparently, there's a big difference between having a file called Discription.xml and a file called Description.xml in your packaged TCX file. Smiley Happy

I've corrected the problem, uploaded a new copy of the TCX.  Please download the latest at https://bitbucket.org/privateteamogre/scriptextensions/downloads/IndicatorTimer.tcx

Join the September Hub-bub to show off, learn and win