BT

InfoQ Homepage News White: A New Windows UI Developer Testing Framework

White: A New Windows UI Developer Testing Framework

Bookmarks

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.

Rate this Article

Adoption
Style

Hello stranger!

You need to Register an InfoQ account or or login to post comments. But there's so much more behind being registered.

Get the most out of the InfoQ experience.

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Community comments

  • window.Get("btnClick1");

    by gauthier segay /

    Your message is awaiting moderation. Thank you for participating in the discussion.

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

  • window.Get("btnClick1");

    by Oscar Rieken /

    Your message is awaiting moderation. Thank you for participating in the discussion.

    I think this should be


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

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

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

BT

Is your profile up-to-date? Please take a moment to review and update.

Note: If updating/changing your email, a validation request will be sent

Company name:
Company role:
Company size:
Country/Zone:
State/Province/Region:
You will be sent an email to validate the new email address. This pop-up will close itself in a few moments.