What | nameofinstrance.xml |
---|---|
Description | Workflow test runs can be configured to automate tests |
schema location | http://fews.wldelft.nl/schemas/version1.0/workflowTestRun.xsd |
Table of Contents |
---|
Introduction
This module allows you to automate test and to run workflows with or without starting-up the user interface. As such, it can also be used to automate tasks in stand-alone systems, for example in combination with the windows task scheduler (or cron in linux systems).
Configuration
fig1: layout of the workflowtestrun configuration
The workflow test run configuration consists of two main parts: General configuration and Activities
General
description
Give an optional description of the workflow test run
dirDefinition
Optional directory references which can be use to refer to directories using a short name.
...
- refName the name which will be used to refer to the directory
- dir the directory to refer to.
systemTime
Optional time to use as system time while running the workflow test. If the system time is not given it is taken from the current computer time.
...
- date date as yyyy-MM-dd
- time the time of day as HH:mm:ss
Activities
The activities of the workflow test run configuration that will be carried out. You can use activities in any order you like, they will be executed as ordered in your configuration file.
PurgeActivity
This activity can be used to remove files or directories to e.g. create an initial situation or to clean up after running the test.
...
- description optional description of the purge activity
- filter name of a file, directory. wild cards can be used (e.g. *test.*)
CopyActivity
Activity can be used to copy files or directories between two locations e.g. to copy files to import to the applications import directory
...
- description optional description of the copy activity
- src source that should be copied to the given destination, wild cards can be used to refine your source
- dest destination where the source should be copied to. wild cards can be used to refine your destination
WorkflowActivity
Runs the workflow file with the given id. The id must be known in the application environment.
ExportTimeSeriesActivity
Exports the given time series to PI formatted file.
...
- exportFile path that specifies the location and name of the export file
- timeSeriesSet time series set as specified here
CompareActivity
Compares an exported file with a given reference file. The comparison will be visible in the log output of the application environment.
...
Workflow test runs can either be started from within a FEWS stand-alone application, or within a JUnit test.
Run workflow test runs from within a FEWS stand-alone
To start a workflow test in DELFT-FEWS open the debug menu (F12) and select 'run workflow test' (U). This will open an open file dialog in which you can select a workflow configuration file to run in the current environment.
Run workflow test runs from JUnit tests
Workflow test runs can be started in JUnit tests in order to build (nightly) regression tests. To do so, initialize the test environment and create a datastore to pass to the workflow constructor. Next code snipped demonstrates the use of WorkflowTestRun in JUnit:
...
// run it
testRun.run(configFile);
....
Run workflow test runs from bin dir
Windows
Workflow test runs can be started from the command line. To do so one must configure a Region as they would for a Stand Alone system. In the bin directory configure the 'Region.exe' and 'Region.jpif' files. For the JPIF file some adaptation must be made. Here is an example:
..\jre
-mx256m
-cp
$JARS_PATH$
nl.wldelft.fews.system.workflowtestrun.WorkflowTestRun
Region_Name
..\path_to_your_config_test_file.xml
The procedure above works (in case of a 1.5 jre) only when double clicking on the exe or when executing it from the windows sceduler. It does not running when calling the exe from a batch file or when calling it directly from the command line. If you need this use a 1.6 jre version and create a batch file similar to the example below:
No Format |
---|
..\jre\bin\java.exe \-mx512m \-cp "*" nl.wldelft.fews.system.workflowtestrun.WorkflowTestRun MYREGION ..\path_to_your_config_test_file.xml
|
Check the attachment workflow_test_run for an example.
...