This repository has been archived by the owner on Apr 15, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
README
50 lines (29 loc) · 2.56 KB
/
README
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# openstreetmap-api-testsuite #
Integration tests for your OSM API code
## About ##
This test suite consists of a series of tests to validate that your OSM API implementation produces the correct results.
There are two parts to the test suite, an OSM XML file to be loaded into the API to be tested, and a gatling test file that specifies the tests.
## Requirements ##
* [gatling](http://gatling-tool.org/) 2.0.0-M3a or later
* The API you want to test, as well as whatever it requires to load the data.
## Installation ##
1. Download [Gatling](http://gatling-tool.org/), version 2.0.0-M3a or greater and unzip it to a folder of your choice. See the [gatling install instructions](https://github.com/excilys/gatling/wiki/Getting-Started#wiki-install) for more information.
2. In the ``user-files/simulations/`` directory under where you unziped it, clone the git repo with
```bash
git clone https://github.com/pnorman/openstreetmap-api-testsuite
```
## Usage ##
1. Load data.xml into the database + API of your choice
2. Apply diff.xml to the database
The first two steps will vary depending on API you are using, but an example for an apidb database loaded with osmosis would be
```bash
osmosis --td database=api_test user=osm password=osm validateSchemaVersion=no && \
osmosis --rx data.xml --wd database=api_test user=osm password=osm validateSchemaVersion=no && \
osmosis --rxc diff.xml --wdc database=api_test user=osm password=osm validateSchemaVersion=no
```
3. Edit the base URL in the OpenStreetMapApiTest.scala file. The default is localhost on port 3000, suitable for use with the the rails port and ``bundle exec rails server``. Make sure the server is actually running.
4. Set ``$GATLING_HOME`` to the directory that was created when you unzipped gatling earlier. If you're currently in the openstreetmap-api-testsuite directory you could do this with ``GATLING_HOME="${PWD%*/*/*/*}"``
5. Run Gatling with $GATLING_HOME/bin/gatling.sh and select the osmapi.ApiSimulation simulation
6. If there are failed tests you can get details of the failures either by scrolling up or in the file `simulation.log` the directory listed. A command like ``grep "REQUEST.*KO" $GATLING_HOME/results/apisimulation-20130826235031/simulation.log`` will find the failed results.
## Test Coverage ##
This software covers the /[node|way|relation]/id# single-element fetch, /(nodes|ways|relations) multi-element fetch, and /[way|relation]/id#/full call. Only GET and HEAD are tested. Each call is in its own .scala file (e.g. Node.scala for /node/id# and Nodes.scala for /nodes)