开源测试框架White

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何其相似。

主页:

http://white.codeplex.com/wikipage

GetStarted指南:

http://white.codeplex.com/wikipage?title=Get%20Started&referringTitle=Home

简单使用:

1、下载解压White_Bin_0.18.zip

2、导入相关dll

3、编写测试代码:

using System;

using System.Collections.Generic;

using System.Text;

using Core.UIItems.WindowItems;

using Core.UIItems;

using Core;

using NUnit.Framework;

using Core.Factory;

namespace WhiteTest1

{

[TestFixture]

public class Class1

{

private string path = @"E:/tmp/AutoBuild/Latest/MyProject/MyProject/bin/Debug/MyProject.exe";

[Test]

public void ButtonClickable_btnClick1_ChangesText()

{

Application application = Application.Launch(path);

Window window = application.GetWindow("Form1", InitializeOption.NoCache);

Button button = window.Get<Button>("button1");

button.Click();

Label label = window.Get<Label>("label1");

Assert.AreEqual("OK!", label.Text);

}

}

}

4、像运行Nunit测试一样运行White测试

相关资源:

http://www.infoq.com/cn/news/2008/02/White-project

http://blog.benhall.me.uk/2008/02/project-white-automated-ui-testing.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值