(ZT)White:一个新的Windows界面开发测试框架

上一篇 / 下一篇  2009-07-23 23:27:29 / 个人分类:其它自动化技术

一种新的界面测试框架发布了,名为White。White与WatiN类似,它封装了微软的UIAutomation库和Window消息,可以用于测试包括Win32,WinForm, WPF和SWT(java)在内的软件。ThoughtWorks的Vivek Singh是该项目的Leader,他已将White放在了CodePlex上。White具有面向对象的API,很容易来控制一个应用,它也可以与xUnit.Net,MbUnit,NUnit,MSTest这样的测试框架结合使用,甚至Fit.Net也可以。

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

Hello World Image

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

[Test]
public void ButtonClickable_btnClick1_ChangesText()
{
    Application application = Application.Launch(path);
    Window window = application.GetWindow("White Hello World", InitializeOption.NoCache);

    Button button = window.Get<button>("btnClick1");   #1
    //Moves the mouse to click the button</button>

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

#1  Using the Get method, we can give it the type and name of the control we want to access.
#2  We can then call the Click method which will move the mouse cursor over to the button and click it.
#3  We can then verify that the action was correctly performed, in this case the Name has changed.

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

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

查看英文原文:White: A New Windows UI Developer Testing Framework

TAG:

 

评分:0

我来说两句

日历

« 2024-05-03  
   1234
567891011
12131415161718
19202122232425
262728293031 

数据统计

  • 访问量: 30875
  • 日志数: 37
  • 建立时间: 2008-07-09
  • 更新时间: 2009-07-23

RSS订阅

Open Toolbar