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

T-Plan Robot Enterprise 4.0.2 Schedules

Contents:

1. Overview
2. Create Schedule
   2.1 Create Empty Schedule
   2.2 Add Scripts To Schedule
3. Execute Schedule
   3.1 Manual Execution
   3.2 CLI Execution
   3.3 Java API Execution

1. Overview

Scheduling is a new feature delivered in v4.0. It allows to create test suites (called "schedules") which define sequences of one or more test scripts to be executed within a single Robot process. Highlights:


2. Create Schedule

Schedules are physically stored as XML files in the schedules/ folder of your project. As test scripts are referenced through relative file paths the test suites will remain functional when the whole project is moved or renamed.

2.1 Create Empty Schedule

Test suites may be easily created and maintained through the Scheduler tool. To create a schedule do one of the following:

Create schedule

The blue rectangular object subtitled "Start settings" represents the top level schedule object. The "Start Type" property defines how the test suite should behave when it gets started (see Execute Schedule for start up options):

The Report Details section allows to configure how the schedule report is created:


2.2 Add Scripts To Schedule

To add the first script to the schedule select (click) the top level schedule object and do one of the following:

The script will appear in the view as a new box titled with the script file name. You may give it an optional display name. To add more scripts:

For example, consider testing of a mobile phone application. There are two test scripts to test it on iOS (iOS.tpr) and Android (Android.tpr). The plan is to execute it first on an iOS 6 device and when it passes retest it also on iOS 7. Testing on Android will be started in parallel. It will be first performed on a Samsung S2 device and if it passes it will be retested on a Samsung S3. The schedule will look as follows:

Example Schedule  
Each script object allows to specify the CLI options. The supported ones are:
Other applicable CLI options such as -n/--nodisplay or -o/--option are accepted only at the level of the Robot start command. They are then applied to all scripts in the schedule. See the Execute Schedule chapter for details on schedule execution.


3. Execute Schedule

Test suites are in general treated the same way as individual test scripts. They can be started in three ways:

  

3.1 Manual Execution

To start the schedule in the GUI mode simply select the Run Execute button on the tool bar or the corresponding Script->Execute menu item while the schedule is opened in the Scheduler tool. Once the schedule is executing you may use the Stop and Pause buttons to stop/pause the schedule. For details on the GUI execution see the Script Editor topic.

When there are both the schedule and a test script opened in the GUI the Execute button always prefers the schedule. To execute the test script alone right click the script editor and select Execute script from the context menu.
Execute Script
As the GUI is not capable of executing test scripts in parallel it will always execute them sequentially (one at a time). For parallel executions use the CLI or Java API execution mode together with the -n/--nodisplay option.


3.2 CLI Execution

Just like test scripts the test suite XML files may be also passed to Robot through the -r/--run CLI option. This will start Robot, execute the schedule and exit. There are two modes:
<Robot_start_command> -r <schedule_XML>
<Robot_start_command> -n -r <schedule_XML>

3.3 Java API Execution

The Java API allows to execute schedules from 3rd party Java applications. This way is suitable for integration of Robot driven automation with custom frameworks. Schedules are treated in the same way as Java test scripts executed from their main() method. The automation runnable may be created through the createAutomatedRunnable(String, String[], PrintStream, boolean) method where the schedule file path gets passed through the -r/--run option inside the arguments:
public static void main(String args[]) {
    ApplicationSupport robot = new ApplicationSupport();
    AutomatedRunnable t = robot.createAutomatedRunnable("Example" , new String[] {"-r", "<path_to_schedule_XML>"}, System.out, true);
    new Thread(t).start();
}
Alternatively there's new createAutomatedRunnable(Schedule, String, String[], PrintStream, boolean) method to create a runnable for an existing Schedule instance:
public static void main(String args[]) throws ParserConfigurationException, SAXException, IOException {
    ApplicationSupport robot = new ApplicationSupport();
    com.tplan.robot.scheduler.Schedule schedule = new com.tplan.robot.scheduler.Schedule();
    schedule.read(new java.io.File("<path_to_schedule_XML>"));
    AutomatedRunnable t = robot.createAutomatedRunnable(schedule, "Example" , new String[] {}, System.out, true);
    new Thread(t).start();
}
Both approaches allow to force the CLI execution mode through putting -n or --nodisplay to the list of input arguments:
AutomatedRunnable t = robot.createAutomatedRunnable("Example" , new String[] {"-n", "-r", "<path_to_schedule_XML>"}, System.out, true);