T-Plan Home
T-Plan Robot Enterprise 4.0.2 Doc Collection
10/06/15

Local Desktop Automation

Last update: 13 December 2012

Contents:
1. Introduction
2. Setting Up
3. Automation


1. Introduction

T-Plan Robot Enterprise version 3.2 introduced support of automation of applications displayed on the local desktop. This means that Robot and one or more Applications Under Test (AUT) run on the same local desktop. The automation is of course not limited to the AUT and it may perform any desktop action that a regular user can do.

Local desktop
      environmentAdvantages:

Limitations:


2. Setting Up

Local desktop automation is supported over two connection types:
  1. The Local Desktop connection relies on the local Java SE installation. There are no other dependencies. To connect simply select the connection in the Login Dialog and hit Connect.
  2. The local desktop can be also automated over a locally running VNC Server:
The Local Desktop connection is the preferred one. It is in general more reliable than the VNC server and it can type non-English characters (see the keyboard support). The Local Desktop connection is also typically faster in terms of screen polling. The VNC server may provide better screen performance if it is attached directly to the video driver, such as for example UltraVNC with the Mirror Driver or TightVNC with the DFMirage driver.

On a successful connection Robot starts up with the Workflow chart displayed instead of the desktop viewer and the application title will indicate the connection (java://localhost or rfb://localhost:5900).


3. Automation

To connect to the local desktop from a test script use the Connect command (TPR scripts) or the connect() method (Java test scripts). The argument URL must be in form of either "java://localhost" (Local Desktop connection type) or "rfb://localhost" (VNC Server).

For example, the following command/method call will connect you to the local desktop using the Local Desktop connection:

TPR test scripts:     Connect java://localhost
Java test scripts:    connect("java://localhost");

To connect to the local desktop using a VNC server running on the standard port of 5900:

TPR test scripts:     Connect rfb://localhost
Java test scripts:    connect("rfb://localhost");

The local desktop automation process differs from the remote one. When Robot needs to work with the local screen it must hide the GUI first. In the test script development phase it applies to situations when the user chooses to perform image comparison, to take a screen shot, to define a screen location or a rectangle, to create a new template image or to perform Component Capture.

Similarly when a script starts to execute, the GUI gets hidden and it is not restored until the scripts finishes. To pause the script execution move the mouse. This will suspend the script and restore the GUI as follows:

Paused script executing on the Local Desktop

While a script is paused the tool bar contains an extra Full/Reduced UI button. It allows to switch the UI to a minimized layout which displays just the script control tool bar buttons:

Minimized UI

To go back to the full UI click the button again. The last selected layout gets saved to the user preferences and used in the script pause mode until the button gets toggled again.

To resume the script simply click the red blinking Resume Resume button or press F5. Avoid changing of the AUT state or switching among applications while a script is paused because the script may fail after you resume it. If you need to do any such a task, bring the AUT to the front before switching to Robot and resuming the script. This will ensure that the AUT window will become the topmost one after Robot hides the GUI.

IMPORTANT: Do not change the OS keyboard layout while using the Local Desktop connection. It maps the layout when the connection is established and any later change may cause the test script press invalid keys. To remap the keyboard disconnect and reconnect. This may be performed even from a test script by a sequence of Disconnect and Connect commands (TPR format) or the disconnect()  and connect() methods (Java format).

Behavior of the local desktop connection can be customized in the Local Desktop panel of the Preferences dialog. The options allow to set the mouse sensitivity for the script pausing purposes and the UI hiding behavior.

Compatibility between the Local Desktop and VNC Server connections is not explicitly guaranteed. A test script designed against a local or remote VNC connection may or may not run correctly with the Local Desktop. The following factors apply:
Version 3.5.2 extended the Exec command to simplify work with local applications which are typically tested over the Local Desktop connection. The basic pattern is that the script starts a local application, tests it and closes it at the script end. Example:
// Start myapp.exe
Exec
"myapp.exe"
nowait="true"

...
// Test the application
...

// Kill the application ('1' is ordinary number of the process started with "Exec nowait=true")
Exec 
kill="1"