Coded UI Test在Windows Vista、2003和2008上需要Windows Automation API 3.0

 最近团队的Nightly run被迁移到装有Windows Vista的Build Agent上执行,98+%的自动化用例执行通过率,还是蛮不错的!但是发现有几个之前(在装有Win7的Build Agent)一直通过的测试用例,突然失败了!今天同事Juan分析了一下这几个失败的用例,它们全部是基于Coded UI Test的,错误的场景让人有点匪夷所思,比如:ListBox.SelectedItems返回Null,之前在Win 7上运行都是很稳定的,经过一段调试还是一头雾水!

      后来仔细观察,发现在执行这些失败用例的时候,系统总有个提示(可不要小瞧这提示,因为没有它,打死我我也不知道要去装下面的补丁。一开始就是忽略这个重要的提示,所以“杯具”了几个小时,呵呵!),要求去更新一下 Windows Automation API,地址连接如下:

于是就按照提示,下载更新了一下基于x86的Windows Vista Automation API。很灵,更新完毕一切OK!

      原来是在Vista和Windows 2003/2008等操作系统上,Coded UI Test的基石之一Windows Automation API版本比较就旧,需要更新到最新的Windows Automation API 3.0,而在Win7则不用。Windows Automation API包括了最新的Microsoft Active Accessiblity和Microsoft UI Automation。如果大家不是很了解这两项技术,下面是从MSDN上摘取的一段简介,言简意赅的对它们进行了解释:

 

" The Windows Automation API consists of two technologies—Microsoft Active Accessibility and Microsoft UI Automation. Microsoft Active Accessibility is the legacy accessibility technology that was introduced as a platform add-in for Windows 95, while Microsoft UI Automation is a newer, more capable technology that overcomes the limitations inherent in Microsoft Active Accessibility. "

" Although Microsoft Active Accessibility and UI Automation are two different technologies, the basic design principles are similar. The purpose of both technologies is to expose rich information about the UI elements used in Windows applications. Developers of accessibility tools can use this information to create software that makes applications running on Windows more accessible to people with vision, hearing, or motion disabilities. "

" Both Microsoft Active Accessibility and UI Automation expose the UI object model as a hierarchical tree, rooted at the desktop. Microsoft Active Accessibility represents individual UI elements as accessible objects, and UI Automation represents them as automation elements. Both refer to the accessibility tool or software automation program as the client. However, Microsoft Active Accessibility refers to the application or control offering the UI for accessibility as the server, while UI Automation refers to this as the provider."


你可能感兴趣的:(automation)