Support for WPF Applications' Controls

Applies to TestComplete 15.69, last modified on November 13, 2024

How TestComplete Records and Simulates Actions on WPF Controls

TestComplete identifies individual GUI objects in .NET applications that use the Windows Presentation Foundation (WPF) UI framework and lets you interact with them from your tests. To learn types of WPF GUI objects, TestComplete uses their .NET class name (the ClrFullClassName property). It tells TestComplete whether the object is a button, check box, combo box and so on. Based on the object type, TestComplete provides a set of object-specific methods and properties for automating various interactions with the object. For example:

  • Item selection in combo box, list box and list view controls is recorded and played back using the ClickItem operation,

  • Clicks on grid cells -- using the ClickCell operation,

  • Calendar date selection -- using the wDate property,

  • And so on.

When you record user actions with supported WPF controls, TestComplete records these special methods and properties applied to the corresponding objects, rather than just coordinate clicks. You can see some of these methods, specifically, SetText, ClickItem and ClickButton, in the sample test below.

Sample keyword test recorded for WPF application

Some controls, such as Label or PictureBox, do not have specific high-level operations associated with them because users do not generally interact with these objects. However, these objects are also available in the application’s object hierarchy, and you can use them in your tests if necessary. For example, you can create checkpoints for these objects.

List of Supported WPF Controls

For a complete list of supported standard and third-party WPF controls and properties and methods that TestComplete provides for automating these controls, see the following topics:

Note that TestComplete provides support both for the listed controls and for their descendants. However, to make this possible, you need to specify the class name of your inherited control in the corresponding group of the project’s Object Mapping options.

Identification of WPF Control Templates

Composite WPF controls that use custom templates can be made more testable by turning on identification of template-generated UI elements. For more information, see Support for WPF Control Templates.

Support for Tabular Controls

TestComplete allows creating table checkpoints for some WPF controls that represent information in a tabular form (for a complete list of these controls see About Tables Collection). With table checkpoints you can retrieve and compare data of WPF tabular controls.

Using Native Properties and Methods of WPF Controls

In addition to specialized methods and properties for automating operations on WPF GUI objects, TestComplete provides access to native methods and properties of these objects. These are the same methods and properties that are used in the application’s source code. You can use these native methods and properties to perform custom manipulations on your tested WPF controls that are not available with standard TestComplete operations. For more information, see Accessing Native Properties and Methods of .NET Objects.

Automating Unsupported WPF Controls

Interactions with unsupported WPF controls are typically recorded as generic coordinate clicks. Nevertheless, you can automate these controls by calling their native methods and properties from your test or using various helper techniques described in the Interacting With Non-Compatible Application Objects topic.

Further Reading

To learn how to perform simple testing operations over application controls, see Working With Standard Windows Controls. This section includes a description of most common control-specific operations you may need to perform over the tested controls, for example, checking a button’s state, determining the number of combo box items, getting tab page images, expanding and collapsing tree view items and so on. For detailed information on the approaches you can use to test your applications’ controls, see the Working With Application Objects and Controls section.

In addition to control-specific operations, there are some common tasks you may need to perform when working with application objects (for example, checking an object's state, searching for an object or checking whether an object exists). For a complete list of these basic operations and for a description of how to perform them, see Common Tasks.

See Also

Testing WPF Applications
Support for WPF Control Templates
About Testing WPF Applications
Supported WPF Technologies
Requirements for Testing WPF Applications

Highlight search results