如何在编码的UI测试中设置组合框的值 [英] How to set a value for combo box in coded UI tests

查看:73
本文介绍了如何在编码的UI测试中设置组合框的值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用VS 2010 for UI为一个应用程序创建测试用例。在该应用程序中,我有一个组合框,最初设置为NULL。您必须单击它以设置焦点,然后再次单击它以获取下拉列表。我使用编码的UI测试记录了这些步骤
。但是当我执行测试时,它会抛出以下异常:

I'm using VS 2010 for UI creating test cases for one application. In that application I have one combo box, which is initially set to NULL. You have to click on it for setting focus and again click on it to get the drop-down list. I have recorded these steps using coded UI tests. But when I execute the test, it throws following exception:

<异常详细信息>

<Exception details>

测试方法WinStep2.CodedUITest1.CodedUITestMethod1抛出异常:

Microsoft.VisualStudio.TestTools.UITest.Extension.UITestControlNotFoundException:播放无法找到具有给定搜索属性的控件。其他详细信息:


TechnologyName:  'MSAA'

ControlType:  'ComboBox'

姓名:  'Field Combo'

  ---> System.Runtime.InteropServices.COMException:错误HRESULT E_FAIL已从调用COM组件返回。

Test method WinStep2.CodedUITest1.CodedUITestMethod1 threw exception:
Microsoft.VisualStudio.TestTools.UITest.Extension.UITestControlNotFoundException: The playback failed to find the control with the given search properties. Additional Details:
TechnologyName:  'MSAA'
ControlType:  'ComboBox'
Name:  'Field Combo'
 ---> System.Runtime.InteropServices.COMException: Error HRESULT E_FAIL has been returned from a call to a COM component.

< /异常详细信息>

</Exception details>

 

生成的代码如下所示:

           &NBSP; //点击"实例资源管理器"菜单项

            Mouse.Click(uIInstanceExplorerMenuItem,new Point(53,8));



           ;&NBSP; //点击"字段名称"单元格为
            Mouse.Click(uIFieldNameCell,new Point(16,8));



           ;&NBSP; //点击"字段组合"组合框

            Mouse.Click(uIFieldComboComboBox,new Point(45,10));         - >这是一个例外。

            // Click 'Instance Explorer' menu item
            Mouse.Click(uIInstanceExplorerMenuItem, new Point(53, 8));

            // Click 'Field Name' cell
            Mouse.Click(uIFieldNameCell, new Point(16, 8));

            // Click 'Field Combo' combo box
            Mouse.Click(uIFieldComboComboBox, new Point(45, 10));         --> This is throwing an exception.

我对VSTT很新,有人请帮忙!!!

I'm very new to VSTT, Somebody please help!!!

谢谢。

推荐答案

Combobox的属性是否正确?

Are the properties of the Combobox correct?

"名称"是否正确?组合框的属性是保持不变还是随组合框中设置的值而变化?

Does the "Name" property of the combobox remain constant or does it vary with the value set in the combobox?


这篇关于如何在编码的UI测试中设置组合框的值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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