Whte:一个新的windows界面开发测试框架

一种新的界面测试框架发布了,名为Whte。Whte与WatN类似,它封装了微软的UAutomaton库和window消息,可以用于测试包括Wn32,WnForm, WPF和SWT(java)在内的软件。ThoughtWorks的Vvek Sngh是该项目的Leader,他已将Whte放在了CodePlex上。Whte具有面向对象的AP,很容易来控制一个应用,它也可以与xUnt.Net,MbUnt,NUnt,MSTest这样的测试框架结合使用,甚至Ft.Net也可以。

Ben Hall就如何使用Whte写了一篇非常好的教程,该教程以示例清晰地说明Whte与WatN和Selenum何其相似。

Hello World image

第一个按钮只有一个非常简单的动作,即当你点击它时,它的名称会改为“Hello World!!”。其测试代码如下:

[Test]
publc vod ButtonClckable_btnClck1_ChangesText()
{
Applcaton applcaton = Applcaton.Launch(path);
window window = applcaton.Getwindow("Whte Hello World", ntalzeOpton.NoCache);

Button button = window.Get("btnClck1"); #1
//Moves the mouse to clck the button

button.Clck(); #2
Assert.AreEqual("Hello World!!", button.Name); #3
}

#1 Usng the Get method, we can gve t the type and name of the control we want to access.
#2 We can then call the Clck method whch wll move the mouse cursor over to the button and clck t.
#3 We can then verfy that the acton was correctly performed, n ths case the Name has changed.


Ben还展示它的其它方面,例如根据可见文字搜索控件,未处理的异常,消息框,以及测试的可读性和非常有用的辅助工具USpy。该教程还对Whte给予了较高评价。

…这个框架给我留下非常深刻的印象。尽管还缺少一些很好的特性(译者注:比如无法优雅地测试Outlook中的Toolbar),但希望它们会不断被追加进来。事实上,这个框架使用了多种不同的U技术,这意味着你不用担心用什么来写你的界面测试,也不用考虑你的界面是否使用了不同的技术。

相关链接:软件测试

打印】【关闭窗口