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

T-Plan Robot Enterprise 4.0.2 Projects

Contents

  1. Overview
  2. Projects And Test Scripts
  3. Migration From Release 2.x
  4. Project View


1. Overview

Support of projects was introduced in the T-Plan Robot Enterprise release 3. A "project" is a directory with predefined layout which serves as a central location for test scripts, template images, test data and test results.

The project directory has the following structure:

<path>\MyAutomation
     
Project MyAutomation home (the project folder name serves as the project name).

classes

Folder for compiled Java classes (*.class files)

reports
Folder for test reports (results)

schedules
Folder for schedule files (since v4.0)

src
Folder for Java test scripts and other Java source code (*.java)

templates
Folder for template image files and collections

tpr

Folder for TPR test scripts (*.tpr)


tprproject.xml

The T-Plan Robot Enterprise project descriptor.

Project folders are designed to be self contained. It can be moved, copied and renamed safely as long as the scripts do not refer through a relative path to other resources located outside of this folder. Such references must be naturally fixed after any change of the project name or location.

The file layout is fixed and can not be customized. The file resources can be naturally put to other locations but they will not be visible in the Project View in the GUI.

The project structure is designed to be compatible with 3rd party Java Integrated Development Environments (IDE) such as Oracle Netbeans. This allows to work on the Java source code simultaneously in the IDE as well as in the T-Plan Robot Enterprise. For details see the Developing Java Test Scripts guide.


2. Projects And Test Scripts

A compilation or execution of each script performs a discovery process which identifies the project the script belongs to. Such a dynamic path configuration allows to copy or move scripts and their dependencies (templates images and data) accross projects without having to fix the script I/O settings. This advantage naturally applies just to test scripts which set their template and output paths to the project ones (see the options below). The project paths are then exposed to test scripts through a set  variables:

Variable
Description
_PROJECT_DIR
The project home directory.
_PROJECT_TEMPLATE_DIR
The project template directory (<project_home>/templates).
_PROJECT_REPORT_DIR The project report home directory (<project_home>/reports).
_PROJECT_REPORT_UNIQUE_DIR A dynamic variable which creates a unique project report (output) path for each script execution.
The path has the form of <project_home>/reports/<script_file_name>_<time_stamp>.<id> where the time
stamp is the execution (compilation) start time in milliseconds elapsed since 1 January 1970 and the ID is a unique
identifier of the owning context.

Though a script can specify any valid output and template paths there are two recommended options to ensure comfortable browsing of the test results and template images in the GUI. You may set the paths manually through inserting of the code below to the beginning of the script. Alternatively use the Paths tool in the GUI.

Option 1:
Version 4.0 and higher:

Omit any path settings in the script. The template path will default to the project one.The output path will default to the unique project output folder to ensure that repeated executions of the same script will store the results to different locations (no result overwriting). It also makes the Test Results branch of the Project View to organize the test results in a hierarchical way by the test script names and dates.

Version 3.x:

The template and output paths in v3 default to the user home folder and must be configured manually. Set the template path to the project one. Set the output path to the unique project output folder to ensure that repeated executions of the same script will store the results to different locations (no result overwriting). It also makes the Test Results branch of the Project View to organize the test results in a hierarchical way by the test script names and dates. This is the default setting which gets applied to any new script:
Script Format
Path Setting Command
TPR
Var _REPORT_DIR="{_PROJECT_REPORT_UNIQUE_DIR}"
Var _TEMPLATE_DIR="{_PROJECT_TEMPLATE_DIR}"
Java
setOutputDir(getVariableAsString("_PROJECT_REPORT_UNIQUE_DIR"));
setTemplateDir(getVariableAsString("_PROJECT_TEMPLATE_DIR"));

Option 2
:
Set the template path to the project one. Set the output path to a static folder located under the project report home. This will make the script overwrite the test results with each execution. Such a path will be also well recognized by the Project View:
Script Format
Path Setting Command
TPR
Var _REPORT_DIR="{_PROJECT_REPORT_DIR}\mytestscript"
Var _TEMPLATE_DIR="{_PROJECT_TEMPLATE_DIR}"
Java
setOutputDir(getVariableAsString("_PROJECT_REPORT_DIR")+java.io.File.separator+"mytestscript");
setTemplateDir(getVariableAsString("_PROJECT_TEMPLATE_DIR"));

For v4.0 and higher you may omit the template path setting because it will default to the project template directory.

3. Migration From Release 2.x

To migrate test scripts, template images and test data from a 2.x release or from a file layout outside of a Robot project:
  1. Create a project.
  2. Move or copy all your template images and image collections into the <project_home>/templates folder. This doesn't apply to the images that your scripts reference by a full (absolute) file path. If you want to see such images in the Project View move them to the project template folder and update your scripts to reference them by a relative path (name).
  3. Move or copy all your TPR test scripts into the <project_home>/tpr folder.
  4. Move or copy all your Java test scripts and/or Java packages into the <project_home>/src folder.
  5. Fix each of your scripts to set the template path to the project one as is described in the previous chapter. If you wish to manage the test results (reports) through the Project View then also change the output path to one of the recommended project ones. Both paths can be comfortably updated through a few clicks through the Paths component (former Settings tab in v2.x).
  6. If your scripts reference any other file resources (Excel sheets, plain text files, ...) in a relative way then update the scripts to reference them correctly. It is highly recommended to move these resources into the project folder and rthen make the script s reference them using the _PROJECT_DIR variable. For example, to open an Excel resource mydata.xls located in the project home folder call:
TPR Format: Excel "open" file="{_PROJECT_DIR}\mydata.xls"
Java Format:   excelOpen( new File(getVariableAsString("_PROJECT_DIR"), "mydata.xls"), (String) null );


4. Project View

The Project View displays resources of the current project. It is organized as a tree. To create a new project do any of the following:

Init

When a project is opened the Project View component displays content of the currently opened project. It is situated under the Project tab at the top left corner of the T-Plan Robot Enterprise main window. The view has a form of a tree where the nodes mostly represent a file or folder or a logical view of files or attributes.

Project View
  1. The root node displays the project name (the project folder name). To get the menu of project specific actions right click it.
  2. The Test Scripts branch provides an overview of test scripts. The view is collated from the existing script source directories of tpr/ (shown as "TPR Test Scripts") and src/ ("Java Test Scripts"). Double clicking a test script node will open it in the Script Editor.
  3. The Component Images branch shows available template images and image collections. A right click onto the branch or any collection (image folder) opens up a menu allowing to capture a new image through the Component Capture feature. Double clicking an image node will open the image in the Template Image Editor.
  4. The Scheduler branch manages schedules (since 4.0). For details read the Schedules topic.
  5. The Test Results node provides a summary of test reports and logs produced by executed test scripts. Results from test scripts which use the unique project report path are displayed as a logical tree where the reports are sorted by the test script and by the execution date and time. To force the view to a physical one and show the raw result folders instead right click the Test Results node and select the File View->Folder/file flat view check box.

    The view shows two file types:

    Report Icon
    Folder Icon
    Status
    Successfully completed.
    Successfully completed
    Execution in progress.
    Successfully completed. Successfully completed Successfully completed (the script returned the exit code of 0).
    Successfully completed. Successfully completed Failed (the script was either stopped or produced an exit code > 0).
    Successfully completed. Successfully completed Invalid report (unknown or corrupted format)
    No report No project
                  available. No XML report available (the folder contains just the execution log and/or a report in the HTML format).