InfoQ

InfoQ

News

My Bookmarks

Login or Register to enable bookmarks for unlimited time.

The content has been bookmarked!

There was an error bookmarking this content! Please retry.

White: A New Windows UI Developer Testing Framework

Posted by Jay Flowers on Feb 20, 2008

Sections
Process & Practices,
Architecture & Design,
Development
Topics
Agile ,
.NET ,
Customers & Requirements ,
Unit Testing ,
Delivering Quality
Tags
xUnit.Net ,
Acceptance Testing ,
MbUnit ,
NUnit ,
Testing ,
MSTest ,
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.

  • This article is part of a featured topic series on Agile

Related Sponsor

In today’s hyper-competitive world, later may be too late to adopt Agile development and this Roadmap for Success will help you get started. Download "Agile Development: A Manager's Roadmap for Success" now!

window.Get("btnClick1"); by gauthier segay Posted
window.Get("btnClick1"); by Oscar Rieken Posted
  1. Back to top

    window.Get("btnClick1");

    by gauthier segay

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

  2. Back to top

    window.Get("btnClick1");

    by Oscar Rieken

    I think this should be


    window.Get<Button>("btnClick1");

    Disregard the closing tag at the bottom it was auto added</button>

Educational Content

New-age Transactional Systems - Not Your Grandpa's OLTP

John Hugg discusses high volume transaction processing applications with high and low frequency profiles, and how VoltDB can be used for that purpose.

Cool Code

Kevlin Henney examines code samples to see what can be learned from them starting from the premise that one won’t write great code unless he knows how to read it.

Collaboration: At the Extremities of Extreme

Jason Ayers share the observations he made watching a team of developers collaborating in real time on the same code base, pushing XP, pair programming and continuous integration to their extremes.

Yesod Web Framework

Michael Snoyman presents Yesod, a web framework written in Haskell and containing a web server, templating, ORM, libraries (templating, gravatar, etc.).

Transactions without Transactions

Richard Kreuter and Kyle Banker on how to avoid classical RDBMS transactional systems by using compensation mechanisms, transactional messaging or transactional procedures.

Attila Szegedi on JVM and GC Performance Tuning at Twitter

Attila Szegedi talks about performance tuning Java and Scala programs at Twitter: how to approach GC problems, the importance of asynchronous I/O, when to use MySQL/Cassandra/Redis, and much more.

10 tips on how to prevent business value risk

One category of risk that project teams need to ensure they address is business value failure – delivering a product that fails to provide value for the business investor.

Interview: Software Systems Architecture: Working With Stakeholders Using Viewpoints and Perspectives

InfoQ spoke to the authors of Software Systems Architecture on a couple of new topics, the System Context viewpoint and Agile, which have been added to the second edition.