White framework is open-source, written in C# and it supports all rich client applications, which are Win32, Win Form, WPF. It is .NET based and does not require the use of any proprietary scripting languages. It provides a consistent object oriented API and it hides all the complexity of Microsoft’s UI Automation library and Win32 Windows messages. It is based on Microsoft’s UI Automation library beneath and provides useful and easy to use wrappers.

Coded UI is another option that can be used but has severe performance impact when compared to White.

Microsoft UI Automation Framework – Base Library

  • Basic core level code library.
  • It is an accessibility technology exposing low-level API to access application.
  • Requires decent amount of helper code to start with.
  • Much complex and hard to create test cases directly.
  • Required considerable amount of time and effort.

CODED UI

  • Can be used for Windows and Web Application as well.
  • Based on Microsoft UI Automation framework.
  • Easy to get started as it provides the play and record feature
  • Good only for small projects
  • Part of Visual Studio starting from VS 2010. (Premium or Ultimate Editions)
  • Difficult to maintain.

White Test Framework

  • Can be used only for Windows Applications.
  • Based on Microsoft UI Automation framework.
  • Requires hand written coding but has easy to understand design.
  • Good for Large projects
  • Better Performance. (Almost 5X as compared to Coded UI)
  • Clean object model.
  • Open Source
  • Highly maintainable code.
  • GitHub – https://github.com/TestStack/White
Coded UI and White depend on Microsoft UI Automation library

White Framework Interaction with the Application under test

 

Getting Hold of the Application windows

White uses the UI Automation API (UIA) to find controls on a window. UIA communicates to a displayed window via window messages. This find is performed by iterating through all the controls in a window. This can be slow for windows which have a lot of UI Items. White supports position-based caching of UI Item find results to improve performance. Speed up performance by Position based search.

With Cache creates a cache of Primary UI Items. This cache is not meant to be used directly by automation programs

Finding a UI Item

 

Finding Item based on Search Criteria

 

Performing action after finding the control.

 

Finding and performing action together

 

You need to install install-package TestStack.White to get started with using White.

 

Sample Test Application

We have 2 text boxes which would accept integer values and a button to add these values. The addition result would be displayed in the 3rd text box.

Now using white we will write simple UI automation test case for addition of 2 numbers for this sample app.