Adding custom properties to CodedUI Test builder

I want to add custom properties for my control in the CodedUI test builder. How can i achieve this?

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

Please help me solve this problem.

thanks

+4
source share
2 answers

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 used the following and am not sure if it applies even to coded-ui, but I know that it exists.

 myLink.SetProperty("PropertyName", "Something"); 
+1
source

Thank you for your suggestion, unfortunately, it does not work.

Finally, I understand what happens in my case. Using the Automation Provider in a custom control (for example, Grid), we can select cells and return only properties supported by AutomationElementIdentifiers, it is impossible to return custom control properties for a test builder.

In the case of a control type, I can only return controls that are part of the AutomationIdentifier.

So, for my grid cell I used ControlType.Edit, but its not very useful, the values ​​in the grid cells are not returned. Therefore, I decided to implement CodedUI support for my control, as described in MSDN .

thanks

Kalai

+1
source

Source: https://habr.com/ru/post/1402590/


All Articles