Using the New GUI Explorer in GUI Testing
Working with the application via its user interface is one of the fundamental features of any automated testing tool. Since the very beginning, TestComplete has supported GUI Testing and it has become even easier to do with every new version.
Previous versions could interact with UI elements in various ways: by simulating mouse actions, by calling specific control methods, by using low-level procedures and events. You also were able to inspect the internal structure of the user interface with the Object Browser. All of those features proved to be effective and convenient. But, there were still certain difficulties when performing GUI testing:
- It was hard to figure out the general layout of an application's windows and controls since the Object Browser reflected the programmatic relations between objects.
- It wasn't easy to explore several controls at one time, especially if one control acted as a container for other controls (control embedding).
- The contents and position of hidden and non-windowed controls was unknown unless they were displayed on the screen.
To resolve these problems, we introduced the GUI Explorer in TestComplete 7. The GUI Explorer allows you to examine an application's user interface at any level: from the general layout to individual controls. The GUI Explorer draws a schematic representation of an on-screen object and up to seven underlying levels of child controls. The tool allows you to observe any on-screen object, no matter if it is visible or invisible, windowed or non-windowed.
With the GUI Explorer it is easier to find the control you need - the controls' layout on the schema is like the one in the application you are analyzing. In addition, you can invoke the context menu for each element on a scheme and highlight the related on-screen object or navigate to the corresponding node in the Object Browser.
For example, the standard My Computer window in Windows XP looks like this:
In the GUI Explorer the same window is represented like the following:
At a first glance it may seem rather complex. This is because embedded controls are drawn smaller than their parent controls, even if they actually have the same dimensions. This is done to reveal control embedding in the window.
The Address toolbar of the My Computer window illustrates control embedding. Examining it with the GUI Explorer, you can find that it actually consists of several controls:
Edit. The last three controls relate to the Address selection combo box. The GUI Explorer represents them as a set of nested rectangles. Note that the graphical representation reflects the actual hierarchy of combo box classes: the
ComboBoxEx32 class is a descendant of the
ComboBox class, which, in turn, is derived from
Edit. Therefore, to obtain the text selected within the control, we should refer to the
Edit object, while to get the contents of the drop-down list we should refer to the
The "scaled-down" schematic representation of controls makes it easier for you to select the on-screen object that corresponds to the UI element you need. Having located the desired on-screen object you can either copy the object's full name to the clipboard or assign the object a custom name via name mapping. Afterwards you can use the object's name to address it from an automated test script or keyword test:
GUI Explorer is a quick way to find the needed on-screen objects since it displays a visual layout similar to the tested application's user interface. The GUI Explorer shows all visible, invisible, windowed, non-windowed and embedded on-screen objects. These objects can then be addressed from keyword tests or from automated test scripts and used in GUI testing. If you haven’t tried the GUI Explorer or TestComplete 7, download it today.