Skip to content

Commit

Permalink
Add tests.yaml example and docs
Browse files Browse the repository at this point in the history
  • Loading branch information
avillar committed Jan 22, 2024
1 parent b2cc809 commit d9028b1
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 4 deletions.
12 changes: 8 additions & 4 deletions TESTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,23 @@ 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:

1. (if JSON and context supplied) JSON-LD uplift ( {testcase}.ttl generated)
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.

Expand Down
9 changes: 9 additions & 0 deletions _sources/my-building-block/tests.yaml
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit d9028b1

Please sign in to comment.