Objects Available to Script Extensions

Applies to TestComplete 15.47, last modified on January 20, 2023

When writing the source script code of a script extensions, you can make use of all means provided by the selected scripting language - JScript or VBScript. In addition, script extensions can use a part of the TestComplete functionality available to usual test scripts. For example, you can use the Sys object to work with processes, windows and objects currently existing in the system, in the same way you do this in your tests. The Log object lets you post messages, errors, warnings and other kinds of entries to the TestComplete test log.

Below is a full list of the TestComplete global scripting objects available to the script extensions:

Object Description
Sys Lets you address and work with processes running on the local computer, work with windows and objects of running processes as well as obtain various system information.
Log Lets you post various kinds of entries to the test log. (Can be used by custom objects and keyword test operations only.)
Note: The Log object cannot be used in the initialization and finalization routines.
NameMapping and
Aliases
Allow you to address applications’ objects by custom names.
UserForms Allows you to display forms included in the script extension.
ADO Lets you connect to databases using ADO and manage databases: read and modify data sets, execute queries and stored procedures, and so on.
aqConvert Lets you convert between various data types.
aqDateTime Lets you perform various operations over the date and time values.
aqEnvironment Lets you obtain information about the operating system, the TestComplete plugins set, and so on.
aqFile Lets you manage files as well as read from and write to text and binary files.
aqFileSystem Enables you to obtain information about drives, folders and files as well as to add, modify and remove files and folders.
aqHttp Lets you create HTTP requests.
aqHttpStatusCode A helper object that you can use to get HTTP status codes.
aqObject Provides an unified way of accessing objects’ members at run time.
aqString Allows you to perform various operations on string values.
aqUtils Lets you perform helper operations, for example, delay the script execution.
DDT Enables you to use data-driven testing drivers to access data stored in Excel and CSV files and ADO database tables.
dotNET Enables you to create and use instances of .NET classes and call routines from .NET assemblies.
Files Lets you manage the Stores | Files collection.
Indicator Lets you change the text and visibility of the TestComplete indicator.
Note: The Indicator object cannot be used in the initialization and finalization routines.
ManualTestBuilder Allows you to create new manual tests.
Objects Lets you manage the Stores | Objects collection.
OCR Allows optical character recognition to be used in script extensions. Depending on whether the legacy OCR plugin or the new OCR plugin is enabled in TestComplete, it is one of the following objects:
  • OCR (legacy)

  • OCR (featuring Google Cloud Vision API)

Project and
ProjectSuite
Provide access to the properties of the user’s current project and project suite, to variables defined in them and to the test logs’ data.
Regions Lets you manage the Stores | Regions collection.
Runner Allows you to call user-defined routines and to stop the test execution from script extensions.
Note: The Runner.CallObjectMethodAsync method is not supported in script extensions.

The Runner object cannot be used in the initialization and finalization routines.

WshShell Provides access to Windows Shell.
XML Lets you manage the Stores | XML collection.

Additionally, script extensions can use the following objects, which are not available to usual TestComplete scripts:

Object Description
aqDlg Lets you display message boxes.
CodeEditor Provides read-write access to the contents of the currently active Code Editor. (Can be used by actions only.)
Help Lets you display help topics for services provided by the script extension. (Can be used by actions and keyword test operations only.)
Options Allows you to work with script extension options.
Recorder Allows you to insert custom code into the script being recorded by TestComplete (can be used by record-time actions only.)
Stores Lets you create collections in the Stores project item and check whether a certain collection exists. (Can be used by actions and keyword test operations only.)
Syntax Lets you generate various script statements. (Can be used by actions only.)

Also, script extensions can use runtime objects implemented in the same or other extensions.

Global Constants

TestComplete global constants like pmHigher (used in Log.Message) or cmpMatches (used in aqObject.CheckProperty) are actually properties of the BuiltIn object. This object is not available in script extensions, so the constants are not defined either. In the script extension code, you need to use the actual values instead of the named constants, or define these constants manually.

JScript

var pmHigher = 400;
Log.Message("test", "", pmHigher);

Log.Message("test", "", 400);

VBScript

Const pmHigher = 400
Call Log.Message("test", "", pmHigher)

Call Log.Message("test", "", 400)

Workarounds for Unavailable Objects

TestedApps

To run applications from script extensions, use WshShell.Run("C:\MyFile.exe"). For more information about this method, see Run Method (Windows Script Host) in MSDN.

KeywordTests

You cannot include keyword tests in script extensions, or call keyword tests in the project. But you can convert the test to a script and include this script in your extension.

See Also

Script Extensions
Creating Script Extensions

Highlight search results