gitmyhub

wiremock

Java ★ 7.3k updated 21h ago

A tool for mocking HTTP services

An open source tool for creating fake HTTP APIs during development and testing, so your app can run against predictable simulated services instead of depending on real external systems like payment processors or databases.

JavaJSONRESTsetup: easycomplexity 3/5

WireMock is an open source tool for creating simulated versions of HTTP APIs. During software development and testing, your application often needs to call external services: payment processors, weather APIs, third-party databases, or other systems your team does not control. WireMock lets you define fake versions of those services that return predictable responses, so your tests and development environment can run without depending on external systems being available, reliable, or correctly configured.

It started in 2011 as a Java library and now works across multiple programming languages. You can run it embedded inside unit tests (so each test controls its own simulated API), as a standalone server process, or inside a container. Configuration is done in Java code, through JSON files, or by calling WireMock's own REST API at runtime.

The matching system lets you define rules that say: when an incoming request matches this URL pattern, these headers, and this request body, respond with this. Rules can match against exact values, regular expressions, or more complex patterns. Response bodies can be dynamically generated using a template system, so a single rule can produce different outputs based on what came in with the request.

WireMock also supports recording and playback: you can point it at a real API, have it capture the actual traffic, and then replay those captured responses in tests without hitting the real service again. Fault injection lets you simulate network errors, timeouts, and slow responses to test how your application handles failures. Stateful behavior simulation lets you model scenarios where the API's response changes based on previous calls, like a workflow that progresses through stages.

WireMock downloads over six million times per month and has full documentation at wiremock.org.

Where it fits