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.
parameters:
- refName the name which will be used to refer to the directory
- dir the directory to refer to.
Activities
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);
....