WireMock HTTP API simulation with request mappings, recorded fixtures and stateful scenarios.
Overview WireMock is an Apache-2.0 API simulation tool for replacing HTTP dependencies during development and testing. Its Java implementation can run with tests or as a standalone service, using authored or recorded mappings to return controlled responses.[1] [2]
Contents Defining mock services A standalone WireMock server can be configured through Java, JSON files or an HTTP administration API, with JAR and container distributions available. A mock describes which incoming requests to match and what responses to return. This allows a client application to exercise expected and exceptional interactions without depending on a live third-party service for every test run.[1] [3]
Recording existing APIs WireMock can proxy traffic to an existing API and derive stub mappings from the requests and responses it observes. Recording and snapshotting offer different ways to capture those interactions. In the documented recorder workflow, mappings are created when recording stops and then begin serving immediately. A recording is therefore a reusable test fixture, not evidence that every possible upstream behavior has been reproduced.[4]
Stateful sequences Scenarios add a state-machine model to mappings. A request can match only in a specified state and move the scenario into another state, allowing a later request to receive a different response. The administration interfaces can inspect, reset or explicitly change scenario state. Resetting is significant for repeatable tests because a previous interaction can otherwise affect which stub matches next.[5]
Operating and sharing mocks The open-source implementation is separate from the commercial WireMock Cloud service. For shared standalone installations, the project's FAQ recommends configuration-as-code and limiting modification APIs to reduce interference between teams. It also warns that a shared instance can be overloaded by combined workloads. Self-hosting consequently gives control over mappings and execution, while leaving capacity and shared-test isolation with the operator.[1]
Substitution scope WireMock can substitute for Mockoon for local HTTP API simulation when Java integration or code-managed mappings fit the test suite. Mockoon supplies a desktop-first authoring experience and its own CLI and data format. The overlap is controlled API behavior, not established file compatibility: request rules, templates and state transitions must be recreated or checked when moving between the tools. Neither successful replay nor a matching payload alone proves an application's compatibility with a changing real service.[3] [5] [6]
Also included: 3 capabilities and 0 substitute relationships. Check substitutes in section 1 and capabilities in section 3.