繁体   English   中英

编码的UI测试:测试运行不会打开简单的菜单

[英]Coded UI Test: The test run will not open a simple menu

我被要求评估Visual Studio的自动化测试工作。 我选择创建一个简单的编码UI测试,我只想打开Minesweeper(Win7版本),玩自定义游戏选项,然后关闭应用程序。

每次运行测试时,它都不会打开“游戏”菜单项。

// Click 'Game' -> 'Options F5' menu item
Mouse.Click(uIOptionsF5MenuItem, new Point(26, 6));

现在,如果我自己单击菜单项(基本上为测试提供“推动”),则自动化将通过选择我需要的菜单选项来接管,然后运行就不会有任何问题。 我只是不知道为什么测试无法单独打开此菜单。 我已经尝试过SetFocus方法,但没有找到其他选择。 MSDN文档提供了零帮助。

有人知道如何打开此菜单吗?

Result Message: 
Test method Blorg.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:  'MenuItem'
Name:  'Options F5'

尝试添加菜单项并执行这样的单击,

WinMenuItem uIOptionsF5MenuItem = new WinMenuItem(Add the window where the menu is placed) {TechnologyName="MSAA" };
uIOptionsF5MenuItem.SearchProperties.Add("Name", "Options F5");
Mouse.Click(uIOptionsF5MenuItem);

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM