1 This directory contains functional tests for the Nominatim API,
2 for the import/update from osm files and for indexing.
4 The tests use the lettuce framework (http://lettuce.it/) and
5 nose (https://nose.readthedocs.org). API tests are meant to be run
6 against a Nominatim installation with a complete planet-wide
7 setup based on a fairly recent planet. If you only have an
8 excerpt, some of the API tests may fail. Database tests can be
9 run without having a database installed.
14 * lettuce framework (http://lettuce.it/)
15 * nose (https://nose.readthedocs.org)
16 * pytidylib (http://countergram.com/open-source/pytidylib)
17 * haversine (https://github.com/mapado/haversine)
24 [sudo] pip install lettuce nose pytidylib haversine
28 NOMINATIM_SERVER=http://your.nominatim.instance/ lettuce features
30 The tests can be configured with a set of environment variables:
32 * `NOMINATIM_SERVER` - URL of the nominatim instance (API tests)
33 * `NOMINATIM_DIR` - source directory of Nominatim (import tests)
34 * `TEMPLATE_DB` - name of template database used as a skeleton for
35 the test databases (db tests)
36 * `TEST_DB` - name of test database (db tests)
37 * `NOMINATIM_SETTINGS` - file to write temporary Nominatim settings to (db tests)
38 * `NOMINATIM_REUSE_TEMPLATE` - if defined, the template database will not be
39 deleted after the test runs and reused during
40 the next run. This speeds up tests considerably
41 but might lead to outdated errors for some
42 changes in the database layout.
43 * `LOGLEVEL` - set to 'debug' to get more verbose output (only works properly
44 when output to a logfile is configured)
45 * `LOGFILE` - sends debug output to the given file
50 The following explanation assume that the reader is familiar with the lettuce
51 notations of features, scenarios and steps.
53 All possible steps can be found in the `steps` directory and should ideally
57 API Tests (`features/api`)
58 --------------------------
60 These tests are meant to test the different API calls and their parameters.
62 There are two kind of steps defined for these tests:
63 request setup steps (see `steps/api_setup.py`)
64 and steps for checking results (see `steps/api_result.py`).
66 Each scenario follows this simple sequence of steps:
68 1. One or more steps to define parameters and HTTP headers of the request.
69 These are cumulative, so you can use multiple steps.
70 2. A single step to call the API. This sends a HTTP request to the configured
71 server and collects the answer. The cached parameters will be deleted,
72 to ensure that the setup works properly with scenario outlines.
73 3. As many result checks as necessary. The result remains cached, so that
74 multiple tests can be added here.
76 Indexing Tests (`features/db`)
77 ---------------------------------------------------
79 These tests check the import and update of the Nominatim database. They do not
80 test the correctness of osm2pgsql. Each test will write some data into the `place`
81 table (and optionally `the planet_osm_*` tables if required) and then run
82 Nominatim's processing functions on that.
84 These tests need to create their own test databases. By default they will be
85 called `test_template_nominatim` and `test_nominatim`. Names can be changed with
86 the environment variables `TEMPLATE_DB` and `TEST_DB`. The user running the tests
87 needs superuser rights for postgres.
90 Import Tests (`features/osm2pgsql`)
91 -----------------------------------
93 These tests check that data is imported correctly into the place table. They
94 use the same template database as the Indexing tests, so the same remarks apply.