Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#820: create simple regression test suite #823

Merged
merged 34 commits into from
Sep 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
e649155
test: add first hurl tests for currentness and mapping saturation ind…
mmerdes Sep 3, 2024
3d1ccf6
test: fix naming for currentness test and its payload # 820
mmerdes Sep 3, 2024
b6de411
test: fix naming for mapping saturation test and its payload # 820
mmerdes Sep 3, 2024
13e1ecf
test: simplify naming #820
mmerdes Sep 6, 2024
ba0c202
test: add test for metadata endpoint and run-script #820
mmerdes Sep 6, 2024
f4cefc3
test: add test with topic and area such that indicator cannot be crea…
mmerdes Sep 6, 2024
facf38f
test: add test for road comparison #820
mmerdes Sep 6, 2024
858daf8
test: add test for building comparison #820
mmerdes Sep 6, 2024
bc7e80e
test: adjust volatile test #820
mmerdes Sep 6, 2024
a647f01
test: add longer-running test for road currentnes #820
mmerdes Sep 9, 2024
ec259ab
test: improve check for content length #820
mmerdes Sep 9, 2024
f0f1386
test: add regexp matching alternative for description check #820
mmerdes Sep 9, 2024
d24cfba
test: add test for completeness of attribute 'address_housenumber' fo…
mmerdes Sep 9, 2024
8ec9837
refactor: fix naming issue #820
mmerdes Sep 10, 2024
f890d0b
test: add test for completeness of attribute 'maxspeed' for roads #820
mmerdes Sep 10, 2024
d62537b
refactor: improve naming #820
mmerdes Sep 10, 2024
b9cee01
refactor: extract base_url variable from all test to env variable #820
mmerdes Sep 10, 2024
d17844b
feat: add per-stage run scripts: TEST #820
mmerdes Sep 10, 2024
e4b8d9c
feat: add per-stage run scripts: PROD #820
mmerdes Sep 10, 2024
be37f81
feat: add per-stage run scripts: DEV #820
mmerdes Sep 10, 2024
63e5553
doc: add README with intro to hurl testing #820
mmerdes Sep 10, 2024
ceb4458
doc: describe regression tests in development docs #820
mmerdes Sep 10, 2024
1acc239
doc: document new regression tests in change log #820
mmerdes Sep 10, 2024
ee78ede
Incorporate review feedback # 820
mmerdes Sep 11, 2024
f42714a
Incorporate review feedback # 820
mmerdes Sep 11, 2024
a16d040
Incorporate review feedback # 820
mmerdes Sep 11, 2024
59fb901
Incorporate review feedback # 820
mmerdes Sep 11, 2024
1849686
Incorporate review feedback # 820
mmerdes Sep 11, 2024
0116cf8
Update regression-tests/__run_hurl_tests_for_stage.sh
mmerdes Sep 11, 2024
74ea4be
Incorporate review feedback # 820
mmerdes Sep 11, 2024
3646b8c
Incorporate review feedback # 820
mmerdes Sep 11, 2024
0068fc4
Incorporate review feedback # 820
mmerdes Sep 11, 2024
1194048
Incorporate review feedback # 820
mmerdes Sep 11, 2024
e6e76de
Incorporate review feedback (batched suggestions) # 820
mmerdes Sep 11, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -152,3 +152,4 @@ cython_debug/
!/config/sample.config.yaml
!/config/logging.yaml
/tests/*/fixtures/approved/*.received.txt
/regression-tests/report/
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,16 @@

- report endpoint: has been deleted ([#818])


### Other Changes

- a new regression test suite has been added to support safer deployments of new versions ([#820])



[#818]: https://github.com/GIScience/ohsome-quality-api/pull/818
[#820]: https://github.com/GIScience/ohsome-quality-api/issues/820


## Release 1.4.0

Expand Down
15 changes: 15 additions & 0 deletions docs/development_setup.md
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,21 @@ approval tests will show the difference to the previously approved version of
the output using a diff tool. If it es as expected resolve the difference using
the diff-tool save and rerun the tests.

### Regression Tests

Unlike the above-mentioned unit and integration tests,
regression tests do not primarily serve to guide and validate the development,
but to check if an upcoming version caused bugs in the existing system.

The regression tests are implemented in `hurl`
and can be run manually on the command line against any of the staging systems.
Please consider adding new `hurl` tests if you add new endpoints.
A `hurl` plugin for JetBrains IDEs (e.g. PyCharm, Intellij Idea etc.)
is available for syntax highlighting and execution within the IDE.

For details, check the
[regression test README](../regression-tests/README.md).

## Logging

Logging is enabled by default.
Expand Down
20 changes: 20 additions & 0 deletions regression-tests/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Regression tests with hurl

Hurl is an HTTP command line client and HTTP test tool:

https://hurl.dev

In order to run the HTTP tests in this directory, `hurl` must be installed.
The tests can be run against the different stages using the following scripts:

* [run_hurl_tests_DEV.sh](./run_hurl_tests_DEV.sh)
* [run_hurl_tests_TEST.sh](./run_hurl_tests_TEST.sh)
* [run_hurl_tests_PROD.sh](./run_hurl_tests_PROD.sh)

Please note that you may get different results depending on the supported endpoints and connected spatial database of the system running on a given stage.

An HTML-report with the results is generated here:

[report/index.html](./report/index.html)


17 changes: 17 additions & 0 deletions regression-tests/__run_hurl_tests_for_stage.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/bin/bash

# requires the env variable $HURL_BASE_URL

rm -rf report
mkdir report

hurl *.hurl --report-html report
printf "\n\nhurl report: file://$PWD/report/index.html\n"

if [[ "$OSTYPE" == "linux-gnu"* ]]; then
xdg-open report/index.html
elif [[ "$OSTYPE" == "darwin"* ]]; then
open report/index.html
else
printf "\nOS could not be detected. Please open report manually!\n"
fi
264 changes: 264 additions & 0 deletions regression-tests/buildingarea_adminarea.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,264 @@
{
"topic": "building-area",
"bpolys": {
"type": "FeatureCollection",
"features": [
{
"type": "Feature",
"id": "admin_world_water.-1392136-_-Mechtersen",
"geometry": {
"type": "MultiPolygon",
"coordinates": [
[
[
[
10.265479,
53.292841
],
[
10.268466,
53.289283
],
[
10.269601,
53.287949
],
[
10.273601,
53.285098
],
[
10.282639,
53.278703
],
[
10.276988,
53.275121
],
[
10.277516,
53.273322
],
[
10.275928,
53.273074
],
[
10.269857,
53.273559
],
[
10.269889,
53.272413
],
[
10.269892,
53.272318
],
[
10.268551,
53.26638
],
[
10.267856,
53.2634
],
[
10.267252,
53.260808
],
[
10.268023,
53.259773
],
[
10.273413,
53.25984
],
[
10.278369,
53.259919
],
[
10.282533,
53.264359
],
[
10.317224,
53.263145
],
[
10.320234,
53.262952
],
[
10.332321,
53.273117
],
[
10.332535,
53.273305
],
[
10.334421,
53.279821
],
[
10.333494,
53.279896
],
[
10.333618,
53.281157
],
[
10.333542,
53.281765
],
[
10.332881,
53.283022
],
[
10.332489,
53.284407
],
[
10.332515,
53.284634
],
[
10.332286,
53.285151
],
[
10.332067,
53.28524
],
[
10.331666,
53.285226
],
[
10.331364,
53.285316
],
[
10.329092,
53.285174
],
[
10.327606,
53.2852
],
[
10.317079,
53.298367
],
[
10.316994,
53.298383
],
[
10.305875,
53.30052
],
[
10.302164,
53.301261
],
[
10.301776,
53.301339
],
[
10.297672,
53.29707
],
[
10.29316,
53.298999
],
[
10.292739,
53.298855
],
[
10.287022,
53.298217
],
[
10.283959,
53.296305
],
[
10.281243,
53.29531
],
[
10.27852,
53.294257
],
[
10.277945,
53.29438
],
[
10.277808,
53.294409
],
[
10.275742,
53.294849
],
[
10.273617,
53.295818
],
[
10.272054,
53.297669
],
[
10.269823,
53.294204
],
[
10.267451,
53.295826
],
[
10.265479,
53.292841
]
]
]
]
},
"geometry_name": "geom",
"properties": {
"id": -1392136,
"iso": null,
"name": "Mechtersen",
"name_en": null,
"local_name": "Mechtersen",
"long_name": null,
"boundary": "administrative",
"admin_level": 8,
"wikidata": "Q503766",
"wikipedia": "de:Mechtersen",
"parents": "[Ljava.lang.Integer;@4e286c37",
"parent": -1969559,
"min_scale": 1,
"max_scale": 500000
},
"bbox": [
10.265478700000036,
53.259772999999974,
10.334420899999964,
53.301338699999974
]
}
]
}
}
23 changes: 23 additions & 0 deletions regression-tests/buildingarea_adminarea_buildingcomparison.hurl
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
POST {{BASE_URL}}/indicators/building-comparison


accept: application/json
[Options]
verbose: true
file,buildingarea_adminarea.json;

HTTP *

[Asserts]
duration < 20000
status == 200
bytes count > 2400

jsonpath "$.result[0].topic.name" == "Building Area"
jsonpath "$.result[0].result.description" contains "The completeness of OSM buildings in your area-of-interest is high. The completeness in comparison to EUBUCCO is 104.27%. The completeness in comparison to Microsoft Building Footprints is 96.16%."
jsonpath "$.result[0].result.label" == "green"





Loading