如何在自动化测试的编解UI中验证下拉控件 [英] How to Validate Dropdown Control in Coded UI for Automation Testing
问题描述
我在VSTS 2010中使用Coded UI为我的WPF应用程序进行自动化测试。我正面临一些问题,其中一些我在下面提到:
I am using Coded UI in VSTS 2010 for doing automated testing for my WPF application. I am facing some issues out of which some I am mentioning below:
1)如何在组合框中验证所有项目是否存在。例如。假设我想在Combox中验证以下项目是否存在:
1) How to validate that in Combo Box all the items are present. For eg. Suppose I want to validate that in Combox followings items should be present:
a)茶
b)咖啡
c)果汁
d)冷饮
2)如何在选择一个ComboBox项目时验证其他ComboBox项目中的值应该如何更改。例如:
2) How to validate that on selecting one ComboBox item the value in other ComboBox item should change. For eg:
如果我选择冷饮,那么在其他ComBo Box中应该有以下项目:
If I select Cold Drink then in other ComBo Box following items should come:
a)百事可乐
b)可口可乐
任何人都可以帮助我使用编码用户界面如何验证上述提及标准。
Can anyone help me how to validate like above mention criteria using Coded UI.
问候
MOhammad Farhan Khan
MOhammad Farhan Khan
推荐答案
参考这个博客
http://blogs.msdn.com/b/gautamg/archive/2010/02/19/useful-set-of-utility-functions-for-coded-ui-test.aspx 用于不同控件的一组实用方法。 ItemExists方法 将解决您的#1和GetContent方法将解决您的#2。
Refer to this blog http://blogs.msdn.com/b/gautamg/archive/2010/02/19/useful-set-of-utility-functions-for-coded-ui-test.aspx for a set of utility methods for different controls. ItemExists method would solve your #1 and GetContent method would solve your #2.
Vinoth。
这篇关于如何在自动化测试的编解UI中验证下拉控件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!