[Tile-serving] [openstreetmap/osm2pgsql] Introduce behaviour-driven testing for integration tests (PR #1670)

Sarah Hoffmann notifications at github.com
Mon Apr 25 14:59:52 UTC 2022


This is work-in-progress to move the regression tests and all unit test that do a simple `run_file` followed by some database queries with a behaviour-driven test framework.

There are a couple of reasons to do this:
* The `run_file` tests are currently spread out over 3 files which makes them very hard to read. The hand-written XML files are a nuisance. The BDD tests collect all in one place and have helper functions for creating point grids and writing auto-completed OPL.
* Each C++ unit test produces a binary of 80MB. The BDD tests would reduce the size of the build directory and reduce build time.
* The regression tests are extremely hard to read because tests are spread out over the entire file.

The BDD tests use [behave](https://github.com/behave/behave), a Python-port of gherkins. Chosen because I can borrow code from Nominatim's BDD framework. (There is a bit of a danger that behave is at a dead end development-wise. Current version 1.2.6 is from 2019 but it works and has all features we need.)

This is a preview to give you an idea of what the BDD feature files would look like. Currently the regression tests for import and the flex area test are ported. In theory, the same framework could later be used by osm2pgsql users to write tests for their own style files or lua flex configurations. In practice, something like this would require a lot of additional documentation.
You can view, comment on, or merge this pull request online at:

  https://github.com/openstreetmap/osm2pgsql/pull/1670

-- Commit Summary --

  * initial framework for BDDs
  * port all import regression tests
  * add first flex test
  * add BDD tests to ctest
  * bdd: check for availability of lua and proj
  * bdd: regression tests need tablespaces
  * add behave to CI

-- File Changes --

    M .github/actions/ubuntu-prerequisites/action.yml (2)
    M .github/actions/win-install/action.yml (4)
    M .github/workflows/ci.yml (2)
    M tests/CMakeLists.txt (15)
    A tests/bdd/.behaverc (3)
    A tests/bdd/environment.py (129)
    A tests/bdd/flex/area.feature (71)
    A tests/bdd/regression/import.feature (184)
    A tests/bdd/steps/geometry_factory.py (110)
    A tests/bdd/steps/steps_db.py (123)
    A tests/bdd/steps/steps_execute.py (84)
    A tests/bdd/steps/steps_osm_data.py (37)

-- Patch Links --

https://github.com/openstreetmap/osm2pgsql/pull/1670.patch
https://github.com/openstreetmap/osm2pgsql/pull/1670.diff

-- 
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/osm2pgsql/pull/1670
You are receiving this because you are subscribed to this thread.

Message ID: <openstreetmap/osm2pgsql/pull/1670 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/tile-serving/attachments/20220425/8cf53c66/attachment.htm>


More information about the Tile-serving mailing list