Description
Use the aqUtils.Delay
method to delay the script execution for a period of time. You may want to delay the script execution when the application under test is performing some time-consuming operations (for example, when it is loading a database or connecting to a network computer).
Declaration
aqUtils.Delay(ms, Str)
ms | [in] | Required | Integer | |
Str | [in] | Optional | String | Default value: “Delays the script execution for ... milliseconds.” |
Result | None |
Applies To
The method is applied to the following object:
Parameters
The method has the following parameters:
ms
The number of milliseconds for which you want to delay the script execution.
Str
Specifies the text that the TestComplete indicator icon shows during a delay.
The default value of Str is “Delays the script execution for ... milliseconds.”, where the ellipsis stands for the number of milliseconds specified by the ms parameter.
You can format the Str string. For example, you can specify a delay time value in it:
JavaScript, JScript
var ms = 5000;
var HelpStr = "Delaying test run for " + ms + "milliseconds.";
aqUtils.Delay (ms, HelpStr);
Python
ms = 5000
HelpStr = "Delaying test run for " + ms + "milliseconds."
aqUtils.Delay(ms, HelpStr)
VBScript
ms = 5000
HelpStr = "Delaying test run for " & ms & "milliseconds."
aqUtils.Delay ms, HelpStr
DelphiScript
var ms, HelpStr: OleVariant;
...
ms := 5000;
HelpStr := 'Delaying test run for ' + aqConvert.VarToStr(ms) + 'milliseconds.';
aqUtils.Delay (ms, HelpStr);
C++Script, C#Script
var ms = 5000;
var HelpStr = "Delaying test run for " + ms + "milliseconds.";
aqUtils["Delay"](ms, HelpStr);
If there is a need for more sophisticated formatting, use the aqString.Format
method.
Result Value
None.
Example
See the Delaying Test Execution topic for an example of using the aqUtils.Delay
method.