Creating a UI Test Extension for Coded UI and Action Recordings

The list below is a step by step guide to the important parts of creating a Coded UI Test Extension. I will be discussing each step in-depth in upcoming posts.

Communication between your extension and your application
Extension Project
  • Create a new Class Library project
Assembly Reference

The property provider is used in the Spy tool so we will start with getting this working.

  • Add a class that inherits the UITestPropertyProvider class. This class provides information about the corresponding UI element can have and gives a way to get/set those properties
  • Add support for the GetControlSupportLevel method. This method is similar to the UITechnologyManager.GetControlSupportLevel method. It provides the engine a way to find the best Property Provider to use for a control dynamically.
  • Add Support for GetPropertyNames method. This method gets the name of all the controls supported by this Property Provider.
  • Add Support for the GetPropertyDescriptor method. The descriptor gives information about the type of property, which category it belongs to (used in the Spy control to group properties) and the attributes (like readable, writable and searchable)
  • Add support for the GetPropertyValue and SetPropertyValue. These methods are used to get or set the property by the check is done on the engine for the property name or
  • Create a class that inherits from the UITechnologyManager abstract class
  • Add the CommVisible attribute to the class to make it visible to the COM
  • Add a Unique and meaningful name to the TechnologyName Property
  • Add logic to the GetControlSupportLevel method to determine how confident the extension is at supporting this specified control. The engine uses the most confident extension
  • Add support for the GetFocusedElement, GetElementFromPoint, GetElementFromWindowHandle, GetElementFromNativeElement and the ConvertToThisTechnology methods. These methods are the different ways the engine can ask for technology specific information.
  • Add Support for the PaseQueryID method which helps with performance by parsing the Search Query ID by parsing it once and caching it for further use.
  • Add Support for the Search method and its fall back MatchElement method. These two methods can be used to find an element
  • Add a class that Implements the UITechnologyElement. This class is responsible for representing a UI Element for the technology being extended.
  • Add support for the QueryID property. This is made out of a property name\value pair that is needed to uniquely identify the control. The technology author is responsible to come up with a good query id that will handle situations like duplicate controls.
  • Add support for the CacheProperties method. This method is called during recording to capture important properties and cache them so they are available to the engine after the UI disappears.
  • Attach to the QTAgent32.exe process and set break points to debug during playback and CodedUITestBuilder.exe to debug during recording /assertion and code generation
  1. #1 by Amit on April 8, 2016 - 1:42 pm


    I am new to CodedUI framework.
    I am automating WPF MVVM application.
    Here I am stuck in a situation, Where xaml file have a “FlowDocumentScrollViewer” control and I have to access its flowdocument for “Data testing”.
    I dont know how can i get flowdocument control and its data.
    So , Please help me and provide any workaround of it. Any suggestion is appreciated.

    I have tried some custom extension , but i dont understand it clearly.

    So please help me to achieve this..

    Thank You…

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: