In the previous topic we
discussed manual execution in the T-Plan Robot Enterprise GUI. It
however
doesn't make much sense to run scripts this way all the time. In an
ideal automation scenario we want to develop a script and
then integrate Robot with the system scheduler or a test management
tool to execute it
automatically against new AUT builds and/or at scheduled intervals.
T-Plan Robot Enterprise offers two integration interfaces, the command line interface (CLI) and the programming Java API
.As
the Java API will be discussed later on, for the purpose of this topic
we will define automatic execution as an unattended script execution started from
the command line interface (CLI) .In simple words, you pass the
necessary parameters through the CLI options and T-Plan Robot will
execute the script and report the result. The most important CLI
options (switches) are:
.tpr
extension) as well as Java source code ( .java
).
The
file
may be either absolute (with full file path given) or relative
to the installation folder. Let's demonstrate the CLI functionality on the latest version of our calculator.tpr
script . In the videos demonstrated so far we have executed the
script on a local VNC server running on port 5901 on Ubuntu Linux and
on a VNC server running on a Windows XP virtual machine with IP
192.168.100.3. To execute the script one would run:
java
-jar
robot.jar
-r calculator.tpr -c rfb://localhost:5901 -p welcome -v
OS=Linux
java
-jar
robot.jar
-r calculator.tpr -c rfb://192.168.100.3 -p welcome -v
OS=Windows
These examples presume that the calculator.tpr
script is
located in the T-Plan Robot Enterprise installation folder and that the
VNC server password is "welcome". As the -n/--nodisplay
switch is not specified, the GUI opens up and shows a simple window
with the start time out (15 seconds by default). Then the script gets
executed. In this phase you are free to interact with the GUI and
interfere with the script in any way; be however aware that any such
action will turn the execution into a manual one and the tool will not
exit automatically. Unless this happens and the script finishes on its
own, the tool counts down the shut down timeout, dismisses the GUI and
terminates the application. It returns to the underlying OS either the
default value of 0 (zero) or the custom value specified by the script
through the Exit command.
When the example commands are run with the -n/--nodisplay
switch, the sequence is similar
save that the progress is reported into the console (command prompt).
The tool counts down the start timeout first. Unlike in GUI this step
can not be skipped. While the script is being executed, it may only be
stopped through Ctrl+C or resumed when the script pauses the execution
through the Pause command. When the script finishes, the shut down sequence is counted
down and the application exits.
The start and shut down time outs are intended to provide an opportunity to interrupt the automatic
process before the script is started or to prevent the application from
exiting. The time out values are configurable through the Scripting->Execution panel of
the Preferences window. To
switch off a time out set its value to zero. To set a custom time out
value temporarily for a particular script execution use the -o/--option
switch. For example, to set up the start time out to 3 seconds include "-o
scripting.delayBeforeAutomaticExecutionSeconds=3"
in your
command.
12 December 2014 |
Copyright © T-Plan Ltd. |
Version 1.0 |