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.)
|
||
NameMapping andAliases |
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.
|
||
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. | ||
Project andProjectSuite |
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.
|
||
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.
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.
|
The indicator icon is displayed at the top-right corner of the screen during test playback. |