This is the fifth post in this series on the extensibility of Coded UI Test. Before reading this, you should read the previous posts of this series to better understand this post.

The ExcelPropertyProvider class extends from UITestPropertyProvider. It provides information about the properties that the corresponding UI element (in this case ExcelCellElement) can have and gives a way to get\set those properties. Let me explain the important methods here –

public override int GetControlSupportLevel(
        UITestControl uiTestControl)

This method is similar to the UITechnologyManager.GetControlSupportLevel() method explained in previous post. This lets engine find out the most suitable property provider for a control dynamically.

public override ICollection<string> GetPropertyNames(
        UITestControl uiTestControl)

This gets the names of all the properties supported by this control.

public override UITestPropertyDescriptor GetPropertyDescriptor(
        UITestControl uiTestControl, string propertyName)

This gets the property descriptor for a given property. The descriptor gives information on what is the data type of the property, which category it belongs to (which is used in Spy control to group the properties) and the attributes of the property (like readable, writeable searchable).

public override object GetPropertyValue(
        UITestControl uiTestControl, string propertyName)
public override void SetPropertyValue(
        UITestControl uiTestControl,
        string propertyName, object propertyValue)

This is the actual get\set method which is called by the engine to allow user to get\set on the properties. No check is done by the engine on either the name of the property or the possible type\allowed value of the property value.

Apart from the above, the property provider also contains bunch of methods that allow customization of code generated by the tool. I will cover this in some future post.

The last post is the one explaining the action filter in the Excel Extension sample.