You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 21 Next »

Workflow test runs can be configured to automate tests.

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.

attributes:

  • 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

attributes:

  • 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.

attributes:

  • 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

attributes:

  • 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.

attributes:

  • 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.

attributes:

  • exportFile location of the file that is to be checked with the reference file
  • compareFile location of the file to compare export file with

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:

....
// init test application
App.init(WorkflowTestRunTest.class);

FewsInstance.init(TestSupport.getInputFile());

TestSupport.setUp();

configDir = TestSupport.getInputFile("config");

relativeViewPeriod = new RelativePeriod(-100 * TimeUnit.DAY_MILLIS, TimeUnit.DAY_MILLIS);

connection = TestSupport.createTestDatabase("test");

// create datastore
dataStore = new TestDataStore(connection, configDir, coldStatesDir, cacheDir, time0);

// select the workflowtest configuration file
File configFile = TestSupport.getInputFile("testfiles/WFT_Test1.xml");

SystemActivityDescriptor descriptor = dataStore.getRuns().getSystemActivityDescriptors().add(SystemActivityType.OC);

// the WorkflowTestRun is created here
WorkflowTestRun testRun = new WorkflowTestRun(dataStore, descriptor);

// run it
testRun.run(configFile);
....

  • No labels