Exposing a Custom Control to Coded UI Tests - WinForms

拈花ヽ惹草 提交于 2019-12-24 04:23:05

问题


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:


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.



来源:https://stackoverflow.com/questions/21606157/exposing-a-custom-control-to-coded-ui-tests-winforms

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!