UIA Pro Add-in
Relevant for: GUI tests and components
This topic provides a basic understanding of the UIA Pro Add-in and how to use UIA Pro to test applications that implement Microsoft UI Automation patterns.
UI Automation Pro (UIA Pro) is an enhanced version of the existing UI Automation Support. Like UI Automation Support, it enables users to test Windows-based applications that have implemented UI Automation provider interfaces.
In addition, it makes test creation and maintenance easier, improves test performance, and provides support for more objects, methods, and patterns.
Using UIA Pro requires the UIA Pro Add-in to be installed and loaded.
An enhanced version of this add-in is available as a Beta offering. To use this version, you must specifically activate it. For details, see UIA Pro Legacy or Enhanced Beta offering.
For implementation guidance and optimization tips, see UIA Pro Add-in Best practices.
UIA Pro patterns
Using the UIA Pro Add-in, you can test applications that implement Microsoft UI Automation patterns regardless of how they appear visually. These patterns define the behavior and capabilities of the UI elements.
Different UI controls implement patterns that match their natural functionality.
For example:
-
Grid Pattern: Controls that display data in rows and columns, enabling capabilities like retrieving and manipulating cell data.
Example: UIAProDataGrid("Grid").GridPattern.GetCellValue(0,0)
-
Invoke Pattern: Controls that can be activated, such as buttons, checkboxes, and other clickable elements.
Example: UIAProButton("Button").InvokePattern.Invoke
-
Scroll Pattern: Controls like scroll bars, list boxes, list views, comboboxes, and other elements that handle scrollable content.
Example: UIAProScrollBar("ScrollBar").ScrollPattern.SetScrollPercent 50,50
Note: The actual patterns available for any control may differ from the examples provided here. The patterns supported by any UI Automation element are determined by the application’s implementation.
To identify the patterns supported by an object:
-
Use the Object Spy tool to inspect objects visually. The SupportedPatterns property lists all patterns supported by the selected object.
-
During runtime, use
UIAProObject("Element").GetSupportedPatterns
method.
UIA Pro functions
Each test object supports many low-level functions that enable detailed communication with the application. To make your work easier, the UIA Pro Add-in also provides high-level functions that package several low-level functions together to provide methods that are more generic and simpler to use. If you need something designed more specifically, build the functionality yourself from the low-level functions.
High-level functions
High-level methods carry out a sequence of low-level functions to perform a specific task. Using a single command to perform the entire operation is simpler, easier to learn, and therefore ideal for standard use cases. The high-level functions are optimized for speed and readability, though they may not support all advanced or edge case scenarios.
Low-level functions
Low-level functions are individual, direct interactions with UI elements that operate at the system or framework level. Using discrete low-level methods gives you full control over each step you perform, directly accessing and manipulate UI elements using specific patterns and properties. Low-level functions are ideal for more complex scenarios that require more advanced customization than the high-level functions provide.
Example:
High-level functions | Low-level functions |
---|---|
UIAProDataGrid("Grid").GridPattern.GetCellText(0,0)
|
UIAProDataGrid("Grid").GridPattern.GetCell(0,0).TextPattern.GetText()
|
UIAProDataGrid("Grid").GridPattern.GetCellValue(0,0)
|
UIAProDataGrid("Grid").GridPattern.GetCell(0,0).ValuePattern.GetValue()
|
UIAProDataGrid("Grid").GridPattern.ClickCell(0,0)
|
UIAProDataGrid("Grid").GridPattern.GetCell(0,0).Click
|
Spy on objects in UIA Pro mode
The Object Spy and Object Identification Center provide a separate mode for UIA Pro object identification. Use this mode to identify objects based on their UI Automation properties and create UIA Pro test objects.
To spy on objects in UIA Pro mode
Do one of the following:
-
In the Object Spy, click the
pointing hand drop-down arrow, select UIA Pro, and click the
button to spy on an object in UIA Pro mode.
-
In the Object Identification Center, click the UIA Pro button to spy on objects in UIA Pro mode.
In the UIA Pro mode, you can view object properties, add the spied object to your local or shared repository, or drag it into your test to create a step. For details, see Use the Object Spy and Use the Object Identification Center.
Object properties are displayed as they would be recognized using UI Automation instead of their native technology.
Create UIAPro test steps
You can create objects and add them to your test from the Object Spy or Object Identification Center.
Each test object supports the following types of methods:
-
OpenText Functional Testing common methods and properties, such as Click and Type.
-
Methods based on a control type's supported patterns. You can use the supportedpatterns description property to check what patterns an object supports.
For details on these test object methods, see the UIA Pro section of the Object Model Reference.
Note: The availability of test objects and methods depends on the properties and patterns implemented in your application. We recommend that you familiarize yourself with the properties of your application's objects - specifically the Control Type IDs and supported patterns to understand what test objects and methods you can use.
See also:
-
For details on Microsoft UI Automation patterns, see the UI Automation overview on MSDN.