This topic describes the TestComplete indicator and explains how you can work with it from your scripts or keyword tests.
What Is Indicator
While TestComplete is recording or playing back scripts, it shows an indicator icon () in the top-right corner of the screen. When performing time-consuming operations, such as waiting for an application response, delaying test run, waiting for object state changes and operations whose run time is known in advance, TestComplete displays text and a progress bar in a balloon near the indicator. The text contains a short description of the operation that is being performed, and the progress bar shows the progress of the operation execution.
For instance, on the image below, you can see that while the Sys.WaitProcess
method is being executed, the progress bar of the indicator displays 30%, which indicates the progress of the current execution.
The indicator contains buttons that allow you to pause and stop test run.
You can stop the test run at any time by pressing the button on the indicator.
To pause the test run, click the button on the indicator. TestComplete will temporarily halt the test run and you will be able to perform any actions. For instance, during a pause, you can explore an object using the Evaluate dialog. To resume the test, click the button.
You can specify the indicator’s text from keyword tests or script routines. To work with the indicator from keyword tests, you use the Push Indicator Text and Pop Indicator Text operations. To work with the indicator from scripts, use methods and properties of the Indicator
object. By using keyword test operations you can set and restore the indicator’s text. The object provides richer functionality. It also contains methods that let you change the indicator’s text and, in addition to these methods, it lets you hide or show the indicator and obtains the indicator’s current text.
Working With Indicator in Keyword Tests
To obtain or set the indicator’s text from a keyword test, use the Push Indicator Text and Pop Indicator Text operations. To specify the indicator’s text from a keyword test, add the Push Indicator Text operation to the test and set the desired text as the operation parameter’s value.
Besides setting the new text, the Push Indicator Text operation saves the current text to an internal list. So, you can restore this text later by using the Pop Indicator Text operation. This operation does not have parameters, it simply restores the text that the indicator had before the text was changed.
For information about changing the indicator’s text, see the Setting Indicator’s Text section below.
Working With Indicator From Scripts
To work with the indicator from scripts, use the Indicator
object. To set the text from a script routine, call the PushText Method
method. It assigns new text to the indicator and saves the current text, so that you can restore it later by calling the PopText Method
method. For example:
JavaScript, JScript
Indicator.PushText("Waiting for my window");
...
Indicator.PopText();
Python
Indicator.PushText("Waiting for my window")
...
Indicator.PopText()
VBScript
Indicator.PushText "Waiting for my window"
...
Indicator.PopText
DelphiScript
Indicator.PushText('Waiting for my window');
...
Indicator.PopText();
C++Script, C#Script
Indicator["PushText"]("Waiting for my window");
...
Indicator["PopText"]();
For information about changing the indicator’s text, see the Setting Indicator’s Text section below.
To obtain the current indicator text, use the Text
property of the Indicator
object.
In your scripts, you can also specify whether the indicator is displayed on the screen. Use the Show
and Hide
methods to show and hide the indicator.
Setting Indicator’s Text
-
When you set the indicator’s text with the Push Indicator Text operation or the
Indicator.PushText
method, TestComplete does not replace the current indicator text with a new string, but stores the current text to a stack. Later, you can restore this text with the Pop Indicator Text operation orIndicator.PopText
method. This functionality frees you from saving and restoring the indicator text manually:Code Instructions Indicator Text Indicator.PushText("Connecting to the server");
...
Connecting to the server Indicator.PushText("Specifying connection properties");
...
Specifying connection properties Indicator.PopText();
...
Connecting to the server Indicator.PushText("Searching for the server");
...
Searching for the server Indicator.PopText()
;...
Connecting to the server Indicator.PopText();
-
To clear the lines in the stack, call the
Clear
method. -
The indicator text is automatically updated every 500 milliseconds. So, if you change the text more frequently, some of the changes will not be visible.
See Also
Running Tests
Running Tests - Tips
Waiting for an Object, Process or Window Activation
Indicator Object
PopText Method
PushText Method
Text Property
Running Keyword Tests
About Script Tests