4
votes

I want to add custom properties of my control to CodedUI test builder. How can i achieve it?

I have used Automation provider to implement support for codedUI test in the control().Only the properties returned by the AutomationElementIdentifiers are visible in the assert window now, what should i do to include the other custom properties in it?

Please guide me to resolve this.

Thanks

2
Have you looked at this MSDN blog on adding custom controls? blogs.msdn.com/b/tapas_sahoos_blog/archive/2010/12/10/… - stoj
Yes, those blogs doesn't help me much. I have tried inheriting the UITestPropertyProvider in the Automation provider, but the overridden methods in the class is not triggered anytime. Is there any choice to add my desired properties in the assert window? control i am using is a WinForm control. - Kalai
any updates on above question :)? - Kalai

2 Answers

1
votes

The following is an example of adding custom properties to a link, but it applies to any other control.

HtmlHyperlink myLink;
myLink.SearchProperties.Add("InnerText", "Custom Inner Text", PropertyExpressionOperator.EqualTo);

I have never actually used the following and not sure if it even applies to coded-ui, but I know it exist.

myLink.SetProperty("PropertyName", "Something");
1
votes

Thank you for your suggestion, unfortunately it doesn't works.

Finally i realize what is happening in my case, While using Automation Provider in a custom Control(like Grid) we can select the cells and can return only the properties supported by the AutomationElementIdentifiers, it is not possible to return the custom properties of the control to the test builder.

In case of control type i can return only the controltypes comes under the AutomationIdentifier.

So for my grid cell i used ControlType.Edit, but its not much helpful, the values in the Grid cells are not returned. So i decided implement the CodedUI support for my control as described in MSDN .

Thanks

Kalai