While we develop the automation script, we generally deal with the application functionality, objects and events. But at the same time, we need to get the information on window objects, on-screen objects and scripting objects etc to achieve the required. In order to get these information as well as to provide access to any specific features, TestComplete has several test objects (like Sys, Builtin, aqUtils etc)  that can be used frequently. In this post we will discuss about some of these useful general test objects and their commonly used methods and properties. 

Sys Object : Sys Object is the frequently used object in TestComplete Scripting, it allows to Control and access all the processes and information about the system outside TestComplete.Different actions like  interact with active windows, simulate key presses etc can be controlled by its methods and properties. for example Sys.Clipboard is used to put text or images to the clipboard or retrieves the clipboard data, Sys.Desktop property is used to access the properties and methods of the Desktop object. The entire screen of PC desktop can can be accessed using this property. We can also get the Host Name, Computer name, Domain Name, OS Name etc using SYS property. Similarly we have different methods like Find, FindAll to access the child objects. Process to access a particular application by its name or index.

for example –

' Storing and getting an image
Set Sys.Clipboard = Sys.Process("notepad").Window("Notepad", "* - Notepad").Picture

' Storing and getting text
Sys.Clipboard = Sys.Process("notepad").Window("Notepad", "* - Notepad").WndCaption

Know more about Sys Object here.

BuiltIn Object : BuiltIn object allows access to different feature of the TestComplete. Most of the methods of the BuiltIn object is considered obsolete and retained only for compatibility with scripts written in earlier versions of TestComplete. New versions of methods can be found in the objects aqFile, aqConvert, aqObject and others.

We can skip the object name (BuiltIn) when calling these methods in TestComplete scripts.

Here are some of the methods of the object BuiltIn, are not currently considered to be obsolete:

InputBox Displays a window that lets the user specify a value that can be used in script.
Log Returns the natural logarithm of a number.
MessageDlg Displays a dialog box.
ParamCount Returns a number of command-line arguments passed to TestComplete at startup.
ParamStr Returns a TestComplete command-line argument specified by its index.
SendMail Sends an e-mail message using the Simple Mail Transfer Protocol (SMTP).
ShowMessage Displays a message box.

The other methods will be of interest to users TestComplete version 6 and below, since these versions still has no facilities aqFile, aqEnvironment etc.

See also  TestComplete Tutorial - A Complete Guide for Beginners

Runner Object : The Runner object is used to control script execution from the script. It includes methods that allow you to stop the script execution and to run routines by their names.

Useful Methods

CallMethod Calls a script routine specified by its name and unit name.
CallObjectMethodAsync Calls the method of the specified application object from scripts asynchronously (that is,CallObjectMethodAsync does not pause the script run until the method execution is over). You can also use this method to obtain a property’s value (that is, to call the property’s get method).
Halt Stops the script execution and posts the specified error string to the log.
Pause Pauses the test execution and activates the debugger.
SetObjectPropertyAsync Sets the property of the specified application object from scripts asynchronously (that is,SetObjectPropertyAsync does not pause the script run until the execution of the property’s set method is over).
Start Initializes TestComplete’s subsystems and runs the tests provided by the current project.
Stop Stops the script execution.

Options Object : This is a very useful object that allows to change some settings and TestComplete project, such as the model used objects in web applications, image parameters (size, quality, etc.), on / off logging, the variables of the project (project variables ), etc. The Code Completion window of the Code Editor displays the list of properties (options) available for the Options object.


TestComplete Helper Object : TestComplete has multiple program objects, some of them are designed for accessing TestComplete’s project items and settings from tests while other objects facilitate testing tasks and provide various helper routines.

The helper program objects are available in each of supported scripting languages, so their functionality is script-independent.

ADO Provides support for working with Microsoft ActiveX Data Objects (ADO): databases, tables, queries, stored procedures, etc.
aqConvert Provides unified methods for converting between various data types: integer to string, date/time to string, variant to boolean and so forth.
aqDateTime Provides unified methods for working with date and time values: retrieve current date, add or subtract one date/time value from another, compare two dates and so on.
aqEnvironment Provides unified methods for obtaining information about the operating system, TestComplete’s plug-in set and for performing various environment-specific operations.
aqFile Provides methods for creating, renaming, copying, deleting files as well as for reading from and writing to text and binary files.
aqFileSystem Provides methods to work with the computer’s file system: obtain information about drives, folders and files, change file attributes, construct relative file paths, connect to the network drive.
aqObject Provides unified methods for operating objects’ members at run time: call methods, compare properties, check if an object has a specified member.
aqString Allows performing various operations with string values: comparing, concatenating, splitting, searching for a substring, replacing occurrences.
AQtimeIntegration Provides a scripting interface to functionality of AQtime 4.7 or later. Contains methods that let you start AQtime, select the desired profiler, start and terminate profiling, generate results and so on.
aqUtils Provides various helper routines like test delay, beep, validate identifier name.
BDE Provides support for working with Borland Database Engine (BDE): retrieve data from databases and tables, execute queries and stored procedures.
BuiltIn Contains named constants and helper routines for manipulating various data, display message dialogs or prompt for user input. Most of routines of this object are obsolete and replaced with analogs from aqNNNobjects.
DbgServices Allows running the desired application in Debug mode or attaching to a running process and enabling TestComplete to trace debug events and exceptions that occur in this process.
DebugAgent Provides a scripting interface used to configure Debug Info Agent.
dotNET Provides a scripting interface for calling routines defined in .NET assemblies.
DLL Provides a scripting interface for calling routines from dynamic link libraries.
HISUtils Makes it possible to use regular expressions in DelphiScript. Also it adds the stopwatch functionality to TestComplete.
Indicator Provides means for controlling TestComplete’s indicator from tests: show, hide, output custom text.
JavaClasses Provides the ability to call routines from Java classes and access Java types and type members.
ManualTestBuilder Provides the ability to create manual tests from scripts.
Options Provides a scripting interface to TestComplete options.
Runner Provides means for controlling script execution from script. It includes methods that allow you to stop the script execution and run routines by their names.
slPacker Provides methods for compressing test results, files and folders from tests.
Utils Provide a scripting interface to various helper objects: PictureRectPointTimers and other.
Win32API Provides the ability to call Win32 API functions from TestComplete tests.
WMI Provides access to the Windows Management Instrumentation (WMI) functionality from TestComplete tests.



Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.