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.
Advantages:
- Single machine scenario with no need of another computer and/or
OS.
- It relies just on the local Java SE installation
and it requires no other software to be installed. This allows to use
Robot in non-intrusive scenarios where the target system may not be
modified. In an extremely isolated scenario, the file based
distributions of Robot and Java can be copied to an external media(CD,
DVD, USB drive) and executed from there to keep the SUT free of any
installation.
- Fast & easy operation.
Limitations:
- Record & replay is not supported.
- Test script relying on the Local
Desktop connection can not be started remotely through a
terminal such as telnet or rsh. Use the VNC Server connection for such
scenarios instead.
2. Setting Up
Local desktop automation is supported over two connection types:
- 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.
- The local desktop can be also automated
over a locally running VNC Server:
- Install a supported VNC Server or enable the system
built-in VNC access (Ubuntu,
Mac OS X)
- Select the VNC Server connection type in the Login Dialog and
connect to localhost. If the server is
configured to use a different port than the standard 5900 one use localhost:<port>,
for
example
localhost:5901.
The Local Desktop connection
is the preferred one. It is faster and more reliable than the VNC
server.
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 using a VNC server running on a custom port of 5901:
TPR test scripts: Connect rfb://localhost:5901
Java test
scripts: connect("
rfb://localhost:5901
");
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:
While a script is paused the tool bar contains an extra button. It
allows to switch the UI to a minimized layout which displays just the
script control tool bar buttons:
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
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.
Compatiblity 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:
- The environments
must match in terms of the OS and the desktop parameters (screen
resolution,
color depth). If the desktop parameters are different the template
images
may fail to compare and you will have to recreate them or add new
alternatives using the Image Collections.
- The Local
Desktop
connection supports a different set of keyboard keys. It can simulate a
press of only those keys that are available in the current system
keyboard layout. For example, if the computer uses the United Kingdom
(GB) keyboard layout, the dollar key ('$') is not there. When Robot is
instructed to press the key using the Press
command it can't press it directly because the physical key asociated
with this character is not available. Robot in such a case uses the
system clipboard to paste the
character instead of pressing it on the keyboard. This will work well
where the character is being typed as part of a text. It will however
not work
correctly where the AUT requires something like "Press the $ key to
continue" and listens to the particular key press event.
Another difference is that while the VNC connection in general supports
just characters from the ASCII 7-bit character set, the Local Desktop
connection can transfer any multibyte (national) characters supported
by the system clipboard. It may for example type a Russian or Greek
text. This allows to employ Robot for localization
(l10n) or internationalization
(i18n) testing.