Skip to content

Getting Started

EOMasters edited this page Apr 28, 2024 · 13 revisions

Set up the Validation Environment

Create a directory for the validation environment and create a subdirectory named tests in it. Within this directory add the test definition files. Those files are JSON files which define the tests to be executed. They must be named like test-<test-name>.json. You can create such files by installing the Product Validation Environment in SNAP and using the Create DAVALIEN Test action from the context menu of the Product you want to test. Alternatively, you can create the files manually, by using the provided template test-def-template.json. Details on the test definition files are described in the Test Definition guide.

Now you are done. This is all what is needed to set up the validation environment. You can add more tests for more files, and you can add additional configuration and resource files.

Additional Files

Config File

To configure the validation environment, you can add a file named config.json to the base directory of the environment. The following configuration options are available:

  • rollingResults - Number of validation results to keep. If not specified, the last two results are kept.
  • deleteResultAfterSuccess - If true the product result files are deleted after a successful validation. In case of an error the result is kept. The default is true.
  • openReport - If set to true the HTML report will be opened in the browser. The default is false.

Example:

{
  "rollingResults": 4,
  "deleteResultAfterSuccess": false,
  "openReport": true
}

Resource Files

You can add additional resource files to the base directory of the environment which define paths to resource files. Three different resource files are possible. The source-products.json, the auxiliary-data.json and the test-graphs.json.

The defined resources can be referenced in the test definition files by their type and id. This allows to reuse the same resource in multiple tests and shortens the definition text. The type of resource is either SRC, AUX or GPH. Each element in the resource file must have a unique id and a path to the resource file, either absolute or relative to the validation environment directory. In the GPT call of the test definition the resource is then referenced by its TYPE and its ID. For example, {SRC:product_ID}, {AUX:shapeFile_ID} or {GPH:graph_ID}.

A resource element can have the following elements:

  • id - The unique id of the resource within its type. It should not contain colons. This is used to reference the resource in the test definition files. This is mandatory.
  • path - The path relative to the base environment directory or the absolute path to the resource file. This is a mandatory attribute. It is recommended to use relative paths to allow to move the environment directory to a different location.
  • description - A description of the resource. This is used in the report files.

Example:

[
  {
    "id": "insitu",
    "path": "path/to/source/insitu.csv"
  },
  {
    "id": "ShapeFile",
    "description": "Shape file for the very specific location",
    "path": "path/to/shape/file.shp"
  }
]

Run the Validation Environment

The DAVALIEN plugin is available via the SNAP Plugin Manager. After installing the Data Validation Environment in SNAP you can run the validation environment by using the command line and the following command:

Windows Unix / Mac
snap64 --validate <envPath> [-N=<TestNameList>] [-T=<TagList>] snap --validate <envPath> [-N=<TestNameList>] [-T=<TagList>]

The envPath is the path to the validation environment directory where the test resources are located and the test results will be stored. The optional parameters are used to filter the tests to be executed:

  • -N=<TestNameList>: Optional comma separated list of test names to execute.
  • -T=<TagList>: Optional comma separated list of tags associated with Tests to be executed.

A test is executed if it matches one of the provided names OR one of the provided tags. If no filtering option is provided, all tests will be executed.

Example:

snap --validate /path/to/validation/environment -N=test-1,test-2 -T=Quick

You should also add the options: --nogui --nosplash This prevents SNAP from showing the shplashscreen and starting the Graphical interface in the background. Example:

snap --nogui --nosplash --validate /path/to/validation/environment -N=test-1,test-2 -T=Quick

Due to an issue in SNAP you need to terminate the process by pressing CTRL+C. (Issue: SNAP-927)