InfoQ

News

White: A New Windows UI Developer Testing Framework

Posted by Jay Flowers on Feb 20, 2008 05:05 PM

Community
.NET,
Agile
Topics
Delivering Quality ,
Customers & Requirements ,
Unit Testing
Tags
NUnit ,
Acceptance Testing ,
Testing ,
MSTest ,
xUnit.Net ,
MbUnit ,
TDD

There is a new UI testing framework in town, White. White is analogous to WatiN, it is a wrapper around Microsoft's UIAutomation Library and Windows messages. Supported test applications include Win32, WinForm, WPF and SWT (java). Vivek Singh, of ThoughtWorks, is the project leader and is hosting White at CodePlex. White’s object oreinted API is used simply to control an application, it is meant to be used in conjunction with a testing framework like xUnit.Net, MbUnit, NUnit, MSTest, or even Fit.Net.

Ben Hall has written an informative tutorial on getting start with White. It is clear how similar White is to WatiN and Selenium in the examples.

Hello World Image

The first button has a simple action, when you click it the text of the button changes to be Hello World!!.  We can then create a test for this as follows:

[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.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 goes on to show other aspects UI testing: searching for controls by visible text, unhandled exceptions, message boxes, test readability, and helpful tools like UISpy. The tutorial concludes with prase for White.

…I'm really impressed with the framework.  There are a few missing features, but hopefully they can be added over time, the fact that the framework does multiple different UI technologies is great, means you don't have to worry about what to use to write your UI tests or if your UI deals with the different technologies.

Related Sponsor

VersionOne is recognized by Agile practitioners as the leader in Agile project management tools. Companies such as Adobe, BBC, CNN, Dow, HP, IBM, Sony and 3M have turned to VersionOne to help deliver greater value to their customers.

1 comment

Reply

window.Get("btnClick1"); by gauthier segay Posted Feb 23, 2008 2:51 PM
  1. Back to top

    window.Get("btnClick1");

    Feb 23, 2008 2:51 PM by gauthier segay

    the code sample doesn't seems to be properly html encoded

Exclusive Content

Ruby.rewrite(Ruby)

In this RubyFringe talk, Reginald Braithwaite writes Ruby code to read, write, and rewrite Ruby. Demos include extending Ruby with conditional expressions, call-by-name and more.

Book Except and Interview : Aptana RadRails, An IDE for Rails Development

Aptana RadRails: An IDE for Rails Development by Javier Ramírez discusses the latest Aptana RadRails IDE, a development environment for creating Ruby on Rails applications.

Fast Bytecodes for Funny Languages

Cliff Click discusses how to optimize generated bytecode for running on the JVM. Click analyzes and reports on several JVM languages and shows several places where they could increase performance.

Scott Ambler On Agile’s Present and Future

Scott Ambler, Practice Lead for Agile Development at IBM, speaks on the current status of the Agile community and practices having a look at the perspective of the Agile’s future.

Manager's Introduction to Test-Driven Development

Dave Nicolette and Karl Scotland try to introduce non-technical managers to one of the most popular Agile development techniques: Test-Driven Development (TDD).

Structured Event Streaming with Smooks

Smooks is best known for its transformation capabilities, but in this article Tom Fennelly describes how you can also use it for structured event streaming.

How to Work With Business Leaders to Manage Architectural Change

Successful architectures evolve over time to meet changing business requirements. Luke Hohmann presents how to collaborate with key members of your business to manage architectural changes.

Colors and the UI

In this article, Dr. Tobias Komischke explains how colors used in a GUI can influence our interaction with a computer and offers advice on using the appropriate colors for the interface.