Testing of desktop applications can be performed within a single workstation through the “Local Desktop” connection method or alternatively through the “VNC Server” connection to a second virtual or physical environment.
Both of the above mentioned connection types allow you to control the entire test environment (SUT) and therefore inherently any applications that are installed there. Testing of this kind however is not limited to any single application, can also include the install/removal of applications along with viewing/adjusting system properties etc.
In fact, once you are connected to the desired SUT you can control any aspect of that environment in exactly the same way that a user would do, manipulating it via the mouse and keyboard whilst analysing the resulting display visually.
It is important to understand that Robot differentiates only the connection type being used, not the application type. Therefore, a native desktop application is handled and automated in exactly the same way as, for example, a web, .NET, Java, Flash, etc application.
Let’s take an example of launching an application…
Firstly launching a standard desktop app such as Calculator would be achieved using the following code in Robot:
Once the application has been started the steps needed to automate it depend on the design of the application itself in terms of the menu/field navigation, data entry, etc. This will in turn determine whether you want to use the mouse or keyboard to perform such actions.
For example, performing an equation in the Windows Calculator could be achieved as follows:
Video of Windows Calculator Sample
However, if you are unsure or indeed know that your application does not support keyboard navigation etc you can use Image and/or text searching as a basis for your mouse.
Calculator example based on image searches:
Similarly, testing of the web application would look the same:
The final part of the jigsaw is then to perform the verification of the applied action. This can again be achieved a number of different ways including typically an image or text search.
Wrapping such a verification into a procedure also means that you can place a verification point at each desired step of your script.
A procedure can include any code you require but a typical verification action may look as follows:
This procedure is then called wherever needed throughout your script like so: