From d9028b189b473b00450724abc3f2c999713aac20 Mon Sep 17 00:00:00 2001 From: Alejandro Villar Date: Mon, 22 Jan 2024 12:40:48 +0100 Subject: [PATCH] Add tests.yaml example and docs --- TESTING.md | 12 ++++++++---- _sources/my-building-block/tests.yaml | 9 +++++++++ 2 files changed, 17 insertions(+), 4 deletions(-) create mode 100644 _sources/my-building-block/tests.yaml diff --git a/TESTING.md b/TESTING.md index 9dbd138..0a0024d 100644 --- a/TESTING.md +++ b/TESTING.md @@ -7,11 +7,15 @@ These can be supplemented with additional custom validation and transformation p ## Examples -Examples defined in the ```examples.yaml``` (inline or by file reference) get validated and included in generated documentation. +Examples defined in the `examples.yaml` (inline or by file reference) get validated and included in generated documentation. -Test cases defines in the ```tests/``` subdirectory of each building block get validated. +Test cases defines in the `tests/` subdirectory of each building block get validated. Additional or external tests +can be added in `tests.yaml` as a list of objects with a `ref` property pointing to the test resource's location, +and optionally defining the `output-filename` and/or `require-fail` properties (for more information, see the +example `tests.yaml` file provided in the template and +[the JSON Schema for `tests.yaml`](https://github.com/opengeospatial/bblocks-postprocess/blob/master/ogc/bblocks/extra-tests-schema.yaml). -In each case, the ```/build/tests/``` directory contains a set of validation outputs. +In each case, the `/build/tests/` directory contains a set of validation outputs. Validation includes the following steps: @@ -19,7 +23,7 @@ Validation includes the following steps: 2. (if JSON schema supplied) JSON schema validation 3. (if SHACL rules defined) SHACL validation -A summary report is produced at ```/build/tests/report.html```. +A summary report is produced at `/build/tests/report.html`. This is linked from the generated building block index. diff --git a/_sources/my-building-block/tests.yaml b/_sources/my-building-block/tests.yaml new file mode 100644 index 0000000..51c8c71 --- /dev/null +++ b/_sources/my-building-block/tests.yaml @@ -0,0 +1,9 @@ +# Additional / external tests resources by reference + +# - ref: https://example.com/my-test.json # Simple test resource by reference + +# - ref: https://example.com/my-other-test.json +# output-filename: different.json # Test with custom output-filename + +# - ref: https://example.com/failing-test.json +# require-fail: true # Override require fail without changing filename \ No newline at end of file