...
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:
No Format |
---|
.... |
...
// 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); |
...
.... |
Run workflow test runs from bin dir
...
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:
No Format |
---|
..\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:
...
Check the attachment workflow_test_run for an example.
Linux
PM