cancel
Showing results for 
Search instead for 
Did you mean: 

IndicatorTimer Script Extension

Highlighted
Community Hero

IndicatorTimer Script Extension

@shankar_r requested a feature addition to TestComplete recently.  You can find his feature request at the following link.

 

https://community.smartbear.com/t5/TestComplete-Feature-Requests/Indicator-Timer/idi-p/131680

 

While I think that this should be something added by default to TestComplete as, perhaps, an option in the Playback project property, in the meantime, I've put together a script extension that will do this in a slightly limited fashion.  You can find the extension at  

https://bitbucket.org/privateteamogre/scriptextensions/downloads/IndicatorTimer.tcx

 

Here's the description of how to implement it from the feature request:

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.


Robert Martin
[Community Expert Group]
Please consider giving a Kudo if I write good stuff
----

Why automate?  I do automated testing because there's only so much a human being can do and remain healthy.  Sleep is a requirement.  So, while people sleep, automation that I create does what I've described above in order to make sure that nothing gets past the final defense of the testing group.
I love good food, good books, good friends, and good fun.

Mysterious Gremlin Master
Extensions available
1 REPLY 1
Community Hero

Re: IndicatorTimer Script Extension

As an FYI, anyone who wants to help contribute to this extension and any others we might develop here as a community, if you have a bitbucket account, I can add you in to the project.  

https://bitbucket.org/privateteamogre/scriptextensions


Robert Martin
[Community Expert Group]
Please consider giving a Kudo if I write good stuff
----

Why automate?  I do automated testing because there's only so much a human being can do and remain healthy.  Sleep is a requirement.  So, while people sleep, automation that I create does what I've described above in order to make sure that nothing gets past the final defense of the testing group.
I love good food, good books, good friends, and good fun.

Mysterious Gremlin Master
Extensions available
New Here?
Join us and watch the welcome video:
Watch the New Interview
APITestingMistake#2