2
votes

I wrote my own custom control in WinForms. It's actually works like a TextBox, but have other methodes and extra properties that I wrote.

I tried writing a very simple coded UI test for this control but faild. Every Time I select it with the Coded UI Test Builder it is shown as "Client" and not as a textbox. I cannot read or write to the text property of this control, or get or set other properties.

Do you know how do I expose my custom control for testing, and getting and setting all of it properties?

1
Making custom controls work with Coded UI is hard work. There are several Microsoft web pages about the topic. A good starting point is the Coded UI content index blogs.msdn.com/b/mathew_aniyan/archive/2010/02/11/… - AdrianHHH
Thanks for the tip, but I tried reading articles on the web and follow them with no success. Can you please give an example in code? - Stack Tack Tack
I tried and I failed to get a Windows Forms custom control to work with Coded UI, but I am not a GUI developer. I would like to have a good and complete example. - AdrianHHH

1 Answers

1
votes

It is difficult to answer the question without looking at your implementation of the custom control but you can use the following link to learn how to extend a treeview control to make it code UI enabled.

http://www.ranorex.com/blog/enabling-automation-by-adding-accessibility-to-windows-forms-controls

I used that example to learn how to extend my own controls.