1、摘要 随着控件技术的不断发展,用户对 WinForm Control 的需求不断增加,使得 WinForm Control 逐渐产品化,一批以 WinForm Control为产品的公司或者部门的 建立更加推动了其快速发展。与此同时,也给 WinForm Control 的自动化测试提 出了新的要求。目前,现有的用于 WinForm Control 自动化测试的自动化测试框 架都是单元测试框架,只能用于测试 WinForm Control 的基本属性、方法和事件, 而其他测试只能手动进行,因此,开发一套面向 WinForm Control 的自动化测试 框架是非常有必要的。 本文深入研究了 W
2、inForm Control的特点,详细分析了 WinForm Control自 动化测试的原理及过程,对现有的单元测试框架做了简单的介绍,通过研究,在 单元测试框架 NUnit 的基础上,着重处理鼠标和键盘的交互操作,并将 GUI 测试 思想应用到 WinForm Control的自动化测试中, 将 WinForm Control的各个组成部 分抽象成一个 ComponentGUI,让测试人员可以方便地定位控件并进行自动化测 试,最终实现了面向 WinForm Control 的自动化测试框架。整个框架在设计上充 分考虑了代码的可复用性、可移植性和可维护性。目前,该自动化测试框架已经 在日本
3、多家控件公司投入使用,达到实用化水平。 关键词:WinForm Control 自动化测试 GUI Input 面向 WinForm Control 的自动化测试框架的设计与实现 Abstract Abstract With the continuous development of control techniques and the increasing demand for WinForm Control, WinForm Control is gradually commercialized in recent years,and the establishment of a grou
4、p of corporations or departments taking WinForm Control as their product further promotes its rapid development. Meanwhile, new requirements of automatic testing of WinForm Control have been arisen. At present, existing automatic testing frameworks for WinForm Control are all unit testing frameworks
5、,which can only be used to test the basic attributes,methods and events of WinForm Control,that is to say,other tests have to be operated manually. Thus,it is very necessary to develop a automatic testing framework for WinForm Control. In this article,the features of WinForm Control are firstly intr
6、oduced,then,the principles and procedures of automatic testing for WinForm Control are discussed in detail and existing unit testing frameworks are also introduced briefly. Finally,a new automatic testing framework for WinForm Control is introduced. The new framework is mainly based on the following ideas:on the basis of the unit testing framework NUnit,focusing on the handling of the interactive operations of keyboard and mouse; and the ideas of GUI based testing are introduced in the automat