Basics Of Windows Automation Testing

This article gives an overview of what Windows Automation Testing is and what UI Automation is.

What is Windows Automation?

Windows Automation is a process of running Windows applications without human intervention to reduce human errors.

What is a Windows Application?

Windows application is a program that is designed/created/written to run/execute on the Microsoft Windows operating system. For example Calculator, Notepad, and WordPad etc.

Note
Windows applications are also referred to as Desktop applications.

To automate any Windows application, first, we should be able to access the information of elements present in that application. Elements are the controls, such as Textbox, Button, Radio button, and Checkbox etc., as shown in the below figure.

 
 
To access the information of these elements, Microsoft provides a framework called "UI Automation".
 

UI Automation

UI Automation is the new accessibility framework for Microsoft Windows available for all Windows operating systems. It provides programmatic access to the user interface (UI) elements on the desktop. So, you may have a doubt such as, "What if my application is not installed on the desktop or is installed at some other location?"

Microsoft Windows operating system is designed in a way that every application we try to access is opened on the top of desktop only. Just like, if we consider a web application, all the controls we see on the screen are available inside the <body> tag only.

So, irrespective of the location where the application is installed, you can access the elements of that application on the desktop. To access the information for the elements, Microsoft also provides tools such as screen readers, which expose the properties and behaviors of the elements.

UI Automation framework provides 3 libraries.
  1. MSAA
  2. UIA2
  3. UIA3
MSAA

MSAA (Microsoft active accessibility) is a COM-based library. MSAA is obsolete, so we are not focusing on this.

UIA2

It is also called the managed library for UI Automation. This can be used to work with win32 and WinForms applications. It doesn’t work well with WPF and Windows store apps but still, we can use it.

This library doesn’t support some of the new features like touch, etc.

UIA3

It is also called COM library for UI Automation. This can be used to work with all type of Windows applications but has some problems with win32 and WinForms applications.

With UI Automation libraries, we can access every piece/control of the application UI as AutomationElement.