white学习1(入门篇)

来源:互联网 发布:成都旅游省钱 知乎 编辑:程序博客网 时间:2024/05/17 22:43

官方网址:http://white.codeplex.com/

简单使用:

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测试

 

本文来自CSDN博客,转载请标明出处:http://blog.csdn.net/Testing_is_believing/archive/2009/11/11/4797026.aspx

 

 

上面是转了陈能技老师写的入门篇,white真的是很好用的开源测试工具,下面是本人学习官方资料的笔记。