将自定义控件暴露给已编码的UI测试-WinForms [英] Exposing a Custom Control to Coded UI Tests - WinForms

查看:181
本文介绍了将自定义控件暴露给已编码的UI测试-WinForms的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在WinForms中编写了自己的自定义控件。它实际上像TextBox一样工作,但是具有我编写的其他方法和其他属性。

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.

我尝试为此控件编写一个非常简单的编码UI测试,但失败了。每次我使用编码的UI测试生成器选择它时,它都显示为客户端而不是文本框。我无法读取或写入此控件的text属性,也无法获取或设置其他属性。

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?

推荐答案

如果不查看自定义控件的实现,很难回答这个问题,但是可以使用以下链接来学习如何扩展树视图控件以使其启用代码UI。

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.

这篇关于将自定义控件暴露给已编码的UI测试-WinForms的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆