TestComplete Test Object Model

Applies to TestComplete 15.31, last modified on March 17, 2022

In automated tests, to simulate user actions on an object (a window, control, web page element) of a tested application, you first need to identify that object: instruct TestComplete how to locate the object. TestComplete is able to recognize individual windows and controls in applications and provide your tests with access to those objects.

Recognized objects are shown in the Object Browser panel of TestComplete:

The Object Browser Panel
Note: The images in this topic demonstrate the object model of desktop applications. The object model of web and mobile applications is similar.

TestComplete uses a tree-like model for test objects. For desktop and web applications, the root node of the tree is Sys, while for mobile applications, the root node is Mobile.

Processes objects correspond to applications running in the operating system. We use the term process rather than application because it corresponds to the concept of processes in Windows documentation.

A process object name includes the name of the process executable and its index (the index is used only if several application instances are running):

Process name

The processes have child objects - windows - that correspond to top-level windows. These objects in their turn have other child window objects that correspond to controls. The window and control names depend on whether or not the test engine has access to internal methods and properties of the application under test. TestComplete works with applications of both types, but names their windows and controls in different ways.

The full name of an object in this structure can be long and hard to read, so you can assign shorter custom names to objects. This way your tests will be easier to read and maintain.

  • Black-box applications

    Applications that do not provide access to their internal methods and properties are called black-box applications. The name of each window of such applications includes the window class name, the window text or title (caption) and its index. Controls are named in the same manner as windows, because in terms of the operating system, a control is just another type of a window:

    Window name (black-box application)
  • White-Box Applications

    Applications that expose their internal objects, methods, and properties to TestComplete are called white-box applications or Open Applications. They are marked with the icon in the Object Browser (see the image below).

    To address windows and controls of Open Applications, TestComplete uses the names that reflect the window or control type and the name defined in the application sources. For instance, if you have a form named MainForm in a C# application created with the Microsoft WinForms library, then TestComplete will address this form as WinFormsObject("MainForm"):

    Object name (Open Application)

For detailed information on naming processes, windows, and controls, see Naming Objects.

Note: It is recommended that, whenever possible, your tests work with Open Applications rather than black-box applications. This enables the test engine to access the application internal methods and properties, allowing you to create more powerful and flexible tests.

Some applications like .NET, WPF, Visual Basic, Java or Web are always “open” to TestComplete. Others may need to be compiled in a special way. For more information on this, see Open Applications.

Prev     Next

See Also

Introducing Automated Testing and TestComplete
Object Browser Naming Notation
Name Mapping

Highlight search results