微软UI自动化库纵览

上一篇 / 下一篇  2008-10-31 14:55:51 / 个人分类:自动化测试框架

  微软自动化类库指的是.net3.0以后的新加入FrameWork的System.Windows.Automation命名空间下的各个类。这个类库的出现为windows的用户界面自动化测试提供了一种新的途径。当然这种方法的限制是你的系统必须支持WPF.

  自动化库遮盖了控件在不同framework中的差异,例如:WPF按钮的Content属性、win32按钮的Caption属性、Html图片的ALT属性,在自动化库中都用Name属性来映射了。自动化库的体系结构使用Privider-Clients形式,也就是说,当你自动化测试的时候,你的测试程序在向被测试程序请求信息,类似与客户端-服务器模型。

  自动化库由4个组成部分,MSDN上介绍如下:

ComponentDescrīption

Provider API (UIAutomationProvider.dll and UIAutomationTypes.dll)

A set of interface definitions that are implemented by UI Automation providers, objects that provide information about UI elements and respond to programmatic input.

Client API (UIAutomationClient.dll and UIAutomationTypes.dll)

A set of types for managed code that enables UI Automation client applications to obtain information about the UI and to send input to controls.

UiAutomationCore.dll

The underlying code (sometimes called the UI Automation core) that handles communication between providers and clients.

UIAutomationClientsideProviders.dll

A set of UI Automation providers for standard legacy controls. (WPF controls have native support for UI Automation.) This support is automatically available to client applications.

  作为自动化测试来说,我们应该只是与ClientAPI打交道(我猜得,^_^)。

自动化控件模式(Pattern)

  控件模式(Control Pattern)提供了一种不依赖与控件的类型和外观来区分和展示控件功能的方法。自动化库使用控件模式(Control Pattern)来代表控件行为。比如:对具有滚动条的控件(可能是下拉框、列表框...)你可以使用Scroll控件模式,每一种控件模式代表了一种功能,因此我们可以用空间模式组合来代表一个具体的控件(如Combobox至少有弹出和选择这两种控件模式)。

  现在有点事,一会在另一篇中继续。。。


TAG: 自动化测试框架

 

评分:0

我来说两句

Open Toolbar