Script Starter

Contents
1. Overview
2. Installation
3. Usage

1. Overview

The Script Starter is a standalone tool which allows to execute one or more T-Plan Robot Enterprise TPR and/or Java test scripts in parallel. This enables to test multiple Systems Under Test (SUT) from a single T-Plan Robot Enterprise instance.

The tool is a simple Java program implementing the principles of multithreaded script execution described in the Developing Java Test Scripts document and the Program Level Execution And Load Testing tutorial topic. The tool is distributed with the source code in the scriptstarter-src.zip file and it is free for use and reuse by the T-Plan Robot Enterprise customers.

2. Installation

The tool requires Java SE 1.6 (JRE or JDK) and T-Plan Robot Enterprise 2.0 or higher. The Java executable must be on the system path. This can be verified through the steps described in the Java Requirements chapter of the Robot's Release Notes. If Java is not on the system path the java call in the ALTERNATIVE 2 below must be replaced with a full path, for example "C:\Program Files\Java\jdk1.6.0_<version>\bin\java".

There are two install options:

  • ALTERNATIVE 1:  Unzip the tool into the Robot's install folder. This way presumes that you will always have to change (cd) to the Robot's install directory and run it from there.
  • ALTERNATIVE 2:  Unzip the tool into a custom location. Then update the scriptstarter.bat  (MS Windows) or scriptstarter.sh (Linux, Unix & Mac OS) file to allow you to call the tool from any location:
  1. Replace robot.jar in the starting command with a full path to the file.
  2. Replace scriptstarter.jar in the starting command with a full path to the file.

For example, if Robot is installed under C:\Program Files\T-Plan\Robot on MS Windows and you unzipped the tool to C:\ScriptStarter the start command will look like:

    java -Xmx512m -cp C:\ScriptStarter\scriptstarter.jar;"C:\Program Files\T-Plan\Robot\robot.jar" StartScripts %1 %2 %3 %4 %5 %6 %7 %8 %9

The Java command from the .bat or .sh file may be naturally executed directly from a command prompt (terminal) or from a 3rd party application, for example from a scheduler. The-Xmx512m  parameter defines how much memory the tool (and also Robot) may use at a maximum. In this case it is 512 MB. For larger deployments with a higher number of test scripts executed in parallel it is recommended to raise the limit to prevent the tool from running out of memory. Principles of the memory optimization are described in the Optimizing Performance chapter of the Robot's Release Notes document.

3. Usage

The test scripts to be started must be specified through a plain text file. Empty lines and lines starting with # will be ignored. Other lines must specify CLI parameters of a single T-Plan Robot process. For a complete list of supported CLI options see the CLI Reference document.
 
For example, the following text file will execute the Script1.tpr and Script2.tpr test scripts in parallel on two different VNC environments:

# Start Script1.tpr on VNC server at rfb://192.168.100.7:5900
-c rfb://192.168.100.7:5900 -r C:\MyProject\tpr\Script1.tpr -n

# Start Script2.tpr on another VNC server at rfb://192.168.100.11:5900
-c rfb://192.168.100.11:5900 -r C:\MyProject\tpr\Script2.tpr -nEach script line must contain at least the -r/--run parameter to define the script to be executed. The line may optionally call the -c/--connect option to make the process connect to the specified SUT prior to starting the script. The script itself may alternatively establish the connection through a call of the Connect command (TPR test scripts) or the connect() method (Java test scripts). It is not recommended to use both the ways at a time for performance reasons because the connection will be established twice.

To pass external data to the script use the -v/--variable switch. For example, the following two lines will start the same script on two different environments where each process will get a different set of values:

-c rfb://192.168.100.7:5900 -r C:\MyProject\tpr\Script1.tpr -n -v "DATAFILE=C:\My Data\data1.xls" -v "MODE=modeA"
-c rfb://192.168.100.11:5900 -r C:\MyProject\tpr\Script1.tpr -n -v "DATAFILE=C:\My Data\data2.xls" -v "MODE=modeB"

As parallel execution is not supported by the GUI, the scripts will be always executed in the CLI mode regardless of whether the lines specify the -n/--nodisplay option or not. The example above lists the option for clarity.

To execute the test scripts start the scriptstarter.bat  (MS Windows) or scriptstarter.sh (Linux, Unix & Mac OS) file and pass it the text file as an argument. Unless you updated the file as is described in the ALTERNATIVE 2 above you will have to change to the install directory and run it from there.

MS Windows:

scriptstarter.bat <text_file>

Linux, Unix & Mac OS:

./scriptstarter.sh <text_file>

For example, to start the scripts in the example file above stored as C:\My Data\scripts.txt  on MS Windows one would execute:

scriptstarter.bat "C:\My Data\scripts.txt"

Be aware that parallel script execution requires you to have a license key with multiple seats and/or multiple valid keys. If the number of executed processes exceeds the number of licensed seats Robot will put the outstanding processes on hold until the other process(es) finish.