project

Projects

Contents:

  1. Overview
  2. Projects And 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 scripts, template images, data and results. The project directory has the following structure:

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 Scripts guide.

2. Projects And 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 scripts which set their template and output paths to the project ones (see the options below). The project paths are then exposed to 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 timestamp is the execution (compilation) start time in milliseconds elapsed since 1 January 1970 and the ID is a uniqueidentifier 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 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 Results branch of the Project View to organize the results in a hierarchical way by the 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 Results branch of the Project View to organize the results in a hierarchical way by the 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 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 scripts, template images and 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 scripts into the <project_home>/tpr folder.
  4. Move or copy all your Java 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 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:

  • Select File->New Project in the menu.
  • Right click the root node of the Project View in the Tool Panel and select New Project in the menu.



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.

  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 Scripts branch provides an overview of scripts. The view is collated from the existing script source directories of tpr/ (shown as "TPR Scripts") and src/ ("Java Scripts"). Double clicking a 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 Workitems branch manages workitems (since 4.0). For details read the Workitems topic.
  5. The Results node provides a summary of reports and logs produced by executed scripts. Results from scripts which use the unique project report path are displayed as a logical tree where the reports are sorted by the 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 Results node and select the File View->Folder/file flat view check box.

    The view shows two file types:
          • The execution log files (of the reserved name of log.html) created by the Execution Log feature.
    • The report files (.xml or .html) are created through a call of the Report command or one of the report() methods in the Java Script API. If the report is in the XML format the report file as well as its folder icons reflect the report status and/or result as follows:

      Report Icon

      Folder Icon

      Status

      Execution in progress.

      Successfully completed (the script returned the exit code of 0).

      Failed (the script was either stopped or produced an exit code > 0).

      Invalid report (unknown or corrupted format)

      No XML report available (the folder contains just the execution log and/or a report in the HTML format).