Getting Started with WHITE .NET/WPF Automation Framework

Automation Testing Published on:
White Framework .Net WPF

Are you a QTP engineer that has often wished there was a way to automated .NET and WPF applications using Visual Studio and C# rather than QuickTest Professional? Do you need to automate a thick client application like WPF, Silverlight, Win32 or WinForms? If so, then WHITE might just be the automation framework for you.

Unlike QTP, which limits you to using VBScript, White allows you to create tests in whichever .NET language you wish — in an IDE that you already use. All this in free open source software — how sweet is that?

Okay. Sounds good so far, but which controls/technologies does it support?

White runs on top of the .NET UI Automation framework. (And just like with QTP, if your application uses third party controls you'll want to verify that WHITE supports them.) White also supports 32 and 64 bit Windows. For more info on what White support check out: Is White the right choice?

Sample .NET Application

I will be using a small .NET sample application I created in Visual Studio 2010 and creatively named.


Before we can start automating our application we'll need a way to spy on the application's fields in order to get the identification properties we'll need to use in order for them to be recognized by WHITE. For this example, I'll use the UI Spy that's installed with the Microsoft Windows SDK. It's located in the \bin folder of the SDK installation path (uispy.exe), or can be accessed from the Start menu (Start\All Programs\Microsoft Windows SDK\Tools\UISpy).

If you start up the test application, then start UI Spy you'll see all the test application's controls in the UI Spy's Control View. The application will be in a tree view. Navigating through the tree view will reveal all your objects along with their properties that can be seen:

Installing the White Automation Framework using Visual Studio

  • First, navigate to the White Downloads page and grab the latest release.
  • Create a folder named White on your local drive and extract the downloaded zip files to it.
  • Open up Visual Studio and create a new .NET Framework 3.5 console application named WHITE.

    • In your new project, go to the Project>Add Reference menu option.
    • Click on Browse and add the White.Core.dll.

  • Add the following namespaces
    using White.Core;
    using White.Core.UIItems;
    using White.Core.UIItems.WindowItems;
    using White.Core.UIItems.WindowStripControls;
    using White.Core.UIItems.MenuItems;
    using White.Core.UIItems.TreeItems;
    using White.Core.UIItems.Finders;
    • To start an application, you must to use the Application.Launch method:
    Application application = Application.Launch(@"D:\Debug\JoeColantonioSampleApp.exe"

    • You can verify that your app has started by using the GetWindow method:


    Window window = application.GetWindow("JoeColantonio.Com Sample .Net App");

    • As with all automation tools, nothing will be very reliable if you don't use some sort of synchronization method to ensure your window/field is active before proceeding. To do this in the WHITE framework, you can use the WaitWhileBusy method:
    • Now we can interact with the fields in our application. Everything in White is a UIItem and has different subclasses that map to corresponding controls. So, to enter text into my application's Patient Name field, I would use the UIItem TextBox control type:
    var patName = window.Get(SearchCriteria.ByAutomationId("txtPatient"));
    • When using WHITE, there are a few methods that can be used to identify objects in your application. The one I use most often is the ByAutomationID.The AutomationID is the programmatic ID assigned by the developer of the application. In Visual Studio this would be the Name property under the Design section:


    The completed script for entering data in all my application's fields looks like this:

    static void Main(string[] args){
      Application application = Application.Launch(@"D:\Debug\JoeColantonioSampleApp.exe");   Window window = application.GetWindow("JoeColantonio.Com Sample .Net App");           window.WaitWhileBusy();
    var patName = window.Get(SearchCriteria.ByAutomationId("txtPatient"));
    var p = window.Get(SearchCriteria.ByAutomationId("cboProvider"));
    p.Select("Crusher, Beverly");
    var dept = window.Get(SearchCriteria.ByAutomationId("cboDepartment"));
    var apptType = window.Get(SearchCriteria.ByAutomationId("cboApptType"));
    var schedType = window.Get(SearchCriteria.ByAutomationId("rdoSchedule"));
    var button = window.Get

    A Simple Example and the Future of White

    This was a simple example to give you a taste of what can be done using the WHITE framework. I'll admit that I haven't tried it on a real-world application so at this stage I'm not sure how robust it really is.

    I also have concerns about how often this open source project is updated. The last release was the August 1, 2011 version 0.21, so development and enhancements for this project have been inactive for some time.

    The good news is there's a good chance that activity will soon increase on WHITE since it was recently acquired by TestStack.

24 responses to “Getting Started with WHITE .NET/WPF Automation Framework”

  1. Hi Joe,
    Just logged in to ask you some open source tool to test windows applications, and see, I found this post.:-)you know it all.All thanks to you.
    I am grateful.


  2. Hi Joe,

    There is very less documentation available for White.Moreover,i dont see any of the DLLs mentioned in your post for White.Can you please suggest some good reading.

  3. Hi Joe when i’m trying to run my application by calling application.launch it is giving me an error message APPLICATION CANNOT EXECUTE WITH READ_ONLY ACCESS RIGHTS , do you ever encounter such rights issue.

  4. I use your method to get Lync Basic 2013 of Microsoft. However, it can’t get a instance of an object . it was stated “Object reference not set to an instance of an object.”

    Do you have any suggest about this issue?

  5. great post, it help me a lot.
    I have a Qustion:
    can I make a test script to a 3third party app, without knowing the name of the controls veriables/objects?

    • Hi Samy – sorry for my late response. Did you resolve this? Not sure I understand your question – are you saying that you are unable to find a unique id to use to identify the fields in the application?

  6. Hi Joe,

    As shown above you have applied an ‘.exe’ in the ‘Application.Launch’. What should I do if I have a ‘.xbap’ URL?

    Pranjal R Nigam

  7. Hello, when i try to invoke an application to automate, it throws an exception because application is already open. what is the solution to this problem?

  8. Hi Joe,

    I was having trouble automating the third party controls such as Farpoint spread for .Net. Just wondering if you could advise me on how to proceed. Because, spy tools such as VisualUIVerify, Spy++ tools do not recognize this control.

    Thanks in Advance,

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

White Framework .Net WPF