motis-sim
A fake MOTIS 2 server for tests.
motis-sim serves recorded responses of the MOTIS API on the loopback
interface, so a client can be tested end to end without a MOTIS instance and
without putting load on a public one like the volunteer-run
Transitous.
- Serves
/api/v6/plan,/api/v6/stoptimes,/api/v6/trip,/api/v1/geocodeand/api/v1/reverse-geocode(API versionv6of MOTIS v2.11.4). Every request gets the recorded response of its endpoint, whatever the query; other paths answer 404 - Injects changes on demand: cancelled trips, a cancelled stop of a trip,
delays, missing realtime data, any status and body for an endpoint, 429
with
Retry-After, slow and malformed responses - Records every request with its path, decoded query and User-Agent, so a test can check what was sent, and that nothing was sent
Fixtures
The responses are trimmed answers of the Transitous instance of MOTIS for Frankfurt (Main) on 2026-11-26:
| Endpoint | Recorded for |
|---|---|
plan |
Hauptbahnhof to Hauptwache, four connections: a direct S4 (DIRECT_TRIP), U5 then U1 with a transfer (FEEDER_TRIP, CONNECTING_TRIP), S5 and S9 |
stoptimes |
Six departures at Hauptbahnhof/Münchener Straße, among them the tram 14 (DEPARTURE_TRIP) |
trip |
The S4 of DIRECT_TRIP, Kronberg to Südbahnhof, with its stops |
geocode, reverse-geocode |
Stops for "Hauptwache", and stops near it |
The constants name trips of the fixtures to aim injections at. The timetable and realtime data come from the sources listed by Transitous, in Germany from DELFI; place data © OpenStreetMap contributors.
In Rust tests
[]
= "1"
use ;
async
Injections stay until Sim::clear(). The sim stops when it is dropped.
In other languages
The binary serves the fixtures until it is interrupted, so tests in any language can start it and point their client at it:
It prints listening on http://127.0.0.1:8080 once it accepts requests and
ends with status 0 on Ctrl-C (SIGINT). Without --port it picks a free
port. Injections are only available from Rust.
Versioning
motis-sim follows Semantic Versioning from 1.0.0: a
breaking change of its public API comes with a new major version only.
License
Apache-2.0
Part of transitous.