SYSTEM Cited by 1 source
Hoverfly¶
Definition¶
Hoverfly (github.com/SpectoLabs/hoverfly)
is an open-source service virtualisation / API mocking tool
written in Go. It can run as a webserver mock (serves
responses for declared request matchers) or as a proxy
(records real traffic for later replay). Configuration is a
single JSON simulation file; invocation is a single binary
(hoverfly -webserver -import simulation.json).
What makes it distinctive¶
-
Record-and-replay. Hoverfly (alongside Mockserver) is in the minority of mock tools that can be pointed at a real dependency, record the traffic, and later replay the captured responses. This reduces the cost of creating mocks for complex third-party APIs.
-
Stateful behaviour via key-value map. Hoverfly mocks can remember state across requests (e.g., a POST creates an order, a later GET returns it) — a capability most static mockers lack.
-
Response templating. The simulation file supports templated fields —
{{ currentDateTime 'Mon, 02 Jan 2020 15:04:05 GMT' }}for request-time timestamps, header interpolation, and dynamic values — without writing code. -
Latency + fault simulation. Configurable fixed or random delay per endpoint; fault-injection switches for resilience testing of callers.
-
Language-agnostic deployment. Single Go binary, HTTP API for runtime control, JSON config — can be deployed next to services in any language stack.
Comparison (from Zalando's evaluation)¶
Zalando's 5-tool shortlist for their load-test mocking layer (sourced from the 2021-03 blog post):
| Tool | Lang | State | Record+Replay | Templating |
|---|---|---|---|---|
| Mobtest | JS | No | No | Yes |
| Wiremock | Java | State machine | No | Yes |
| Mockserver | Java | No | Yes | No |
| Mokoon | JS | No | No | Yes |
| Hoverfly | Go | k/v map | Yes | Yes |
Zalando picked Hoverfly for record-and-replay + statefulness + language-agnostic deployment.
Typical simulation file¶
{
"data": {
"pairs": [{
"request": {
"path": [{"matcher": "exact", "value": "/test"}],
"method": [{"matcher": "exact", "value": "PATCH"}]
},
"response": {
"status": 204,
"body": "",
"headers": {
"Date": ["{{ currentDateTime 'Mon, 02 Jan 2020 15:04:05 GMT' }}"],
"Load-Test": ["true"]
},
"templated": true
}
}],
"globalActions": {"delays": []}
},
"meta": {"schemaVersion": "v5"}
}
Seen in¶
- sources/2021-03-01-zalando-building-an-end-to-end-load-test-automation-system-on-top-of-kubernetes — Hoverfly mocks every external dependency for Zalando Payments' isolated load-test cluster. Used in combination with Skipper header-based routing so a single service deployment can dynamically switch between real and mocked dependency per request.
Related¶
- systems/wiremock · systems/mockserver
- patterns/mock-external-dependencies-for-isolated-load-test
- systems/locust — common pairing: Locust drives load, Hoverfly isolates third-party dependencies.
- companies/zalando