Utilities Object

Applies to TestComplete 14.30, last modified on November 21, 2019
This object is obsolete. See the Remarks section below.

Description

The Utilities object makes many functions and variables of the Borland VCL SysUtils unit available to TestComplete scripts. The supported functions become methods of the Utilities object and variables become its properties.

The SysUtils unit holds a number of functions that work with files, convert numbers to strings and vice versa, process strings in different ways, etc. Only the functions and procedures that use OLE-compatible types are supported (except for those that use pointers as parameters or return values, and those that return values through reference parameters). This is the core rule for all scripting languages used in TestComplete -- only OLE-compatible types, and no pointers or values are changed through reference parameters.

Note: Support for the Utilities object is provided in TestComplete by default, regardless of which TestComplete Modules you have installed.

You may skip the Utilities object name when calling the object’s methods. For instance, the following two lines are equivalent:

JavaScript, JScript

d = Utilities.StrToDateTime("5/01/2003");
d = StrToDateTime("5/01/2003");

Python

d = Utilities.StrToDateTime("5/01/2003")
d = StrToDateTime("5/01/2003")

VBScript

d = Utilities.StrToDateTime("5/01/2003")
d = StrToDateTime("5/01/2003")

DelphiScript

d := Utilities.StrToDateTime('5/01/2003');
d := StrToDateTime('5/01/2003');

C++Script, C#Script

d = Utilities["StrToDateTime"]("5/01/2003");
d = StrToDateTime("5/01/2003");

Note, however, that omitting the Utilities object name may cause name recognition conflicts. For instance, if you call the Beep routine in your JScript code, an error will occur. This happens because both Win32API and Utilities objects include methods called Beep, so TestComplete does not “know” which function to call. To solve the problem, put the object name before the function name, that is, use aqUtils.Beep().

Also, if the name of the Utilities object’s function coincides with the function name provided by the scripting language, TestComplete will call the scripting language’s function. To solve the problem, place the object name before the method name. See Specifics of Usage Common for All Languages.

As usual, if you call a SysUtils function and the function is not supported, an error message will be posted to the test log.

Members

Remarks

The Utilities object is obsolete and supported for backward compatibility only. It is not displayed in the Code Completion window. For equivalents of the Utilities object’s properties and methods, see TestComplete helper objects.

See Also

TestComplete Helper Objects
aqConvert Object
aqDateTime Object
aqEnvironment Object
aqFile Object
aqFileSystem Object
aqObject Object
aqString Object
aqUtils Object
List of Built-In Routines

Highlight search results