TOPIC 58/6215 MINNOT STARTED

Service virtualisation with WireMock

Use a stand-in web service to test set replies, slow replies and faults. Check what it received, and keep its limits clear.

L1–L4 are part of the Pro pass

L0 Explain simply

Analogy: a stunt double. A film crew plans a fall before it starts the scene. The double follows that plan. It does not act out every part of the real actor's life.

puts a in place of a real one. WireMock can play that part for web calls. Tom tests Daily List, a to-do list app. He points its plan lookup at his own test server.

A pairs a request rule with a reply. Tom gives the stand-in a rule for user 7. Its reply says the plan is Pro. The app should show Pro after it reads that reply.

means making a chosen failure happen on purpose. Tom can arrange a slow reply or a server error. He checks what the app does in each case.

The result has a limit. A good test shows how the app handles the chosen scene. It does not prove that the real plan service works, or that every failure is covered. Keep separate checks against the agreed service rules and an approved real test service.

PLAIN WORDS · 1 in this section
stub
a simple fake part that gives fixed answers

PICTURE IT

The picture is the one the lesson above opens with. The table below shows how each part of it matches the software.

THE REAL JOB Test an app with chosen service replies and faults.

  1. Match
  2. Reply
  3. Fault
Stunt double

HOW THE PICTURE MAPS

How each part of the picture matches the software
In the pictureIn the software
The stunt doubleThe stand-in service
A cueA stub mapping
Telling it to fallFault injection
The real actorThe real service

WHERE THIS PICTURE STOPS

  • A stand-in follows only the rules written for it, not the whole real service.
  • A passing scene does not prove the real service works.
  • A recorded scene does not cover every request or failure.

HOOK

Choose, call, check.

TELL A FRIEND

A stunt double follows the chosen scene; a stand-in follows the chosen service rules.

OFTEN MIXED UP WITH Stand-ins for other systems: stubs and mocks. That topic explains stubs and mocks as ideas. This one uses a tool to run a .

Sources & standards — 2 sources
  1. Market practice

    Stubbing (WireMock documentation) ↗ — WireMock · Basic stubbing, stub priority, unmapped replies, reset and reset-to-default: current official page opened 8 November 2026. Local examples separately checked with WireMock Java 3.13.1.

    The WireMock stubbing pages say a mapping has a request part and a response part. The request part holds a method and a web address. The response part holds a status and a body. A mapping can be a file in the mappings folder, or it can be sent to the admin address. · Checked 2026-11-08

    Found through a web search; the page was not opened (search excerpt, page not opened). Version: Web page, no edition number. Licence terms were not read, so put it in your own words and do not quote it. Open the page and confirm what it says before relying on any detail. Supplement6November2026: actual current and archived2.x stubbing pages opened; priority then most-recent matching stub; reset paths also documented in2.x. V27 supplement, 6 November 2026: relevant primary page sections actually opened; implementation-specific current product guidance, not universal standard. See full V27 audit for version and access scope.

    8 November 2026: actual live WireMock Java Basic Stubbing and complete Stub Priority section/examples opened. Request mappings select configured responses; no installed-version or every-feature claim.

    WireMock topic review, 8 November 2026: Basic stubbing, stub priority, unmapped replies, reset and reset-to-default: current official page opened 8 November 2026. Local examples separately checked with WireMock Java 3.13.1.

    Version-specific correction: the general Reset paragraph says all mappings are removed, but WireMock Java 3.13.1 resetAll reloads defaults. See v945-wiremock-3131-reset-source and the local runtime tests. Do not infer an empty mapping list when files are present.

  2. Market practice

    Simulating faults (WireMock documentation) ↗ — WireMock · Per-stub fixed delays and bad responses. Current official page opened 8 November 2026; delays are milliseconds and connection faults differ from status replies.

    The WireMock pages on faults describe a fixed delay in milliseconds on a response. They also describe a fault setting on the response with values such as an empty response, a malformed chunk and a connection reset. · Checked 2026-11-08

    Found through a web search; the page was not opened (search excerpt, page not opened). Version: Web page, no edition number. Licence terms were not read, so put it in your own words and do not quote it. Open the page and confirm what it says before relying on any detail. V27 supplement, 6 November 2026: relevant primary page sections actually opened; implementation-specific current product guidance, not universal standard. See full V27 audit for version and access scope.

    WireMock topic review, 8 November 2026: Per-stub fixed delays and bad responses. Current official page opened 8 November 2026; delays are milliseconds and connection faults differ from status replies.

PRACTISE AND KEEP

Sources for this topic — 8 sources
  1. Market practice

    Stubbing (WireMock documentation) ↗ — WireMock · Basic stubbing, stub priority, unmapped replies, reset and reset-to-default: current official page opened 8 November 2026. Local examples separately checked with WireMock Java 3.13.1.

    The WireMock stubbing pages say a mapping has a request part and a response part. The request part holds a method and a web address. The response part holds a status and a body. A mapping can be a file in the mappings folder, or it can be sent to the admin address. · Checked 2026-11-08

    Found through a web search; the page was not opened (search excerpt, page not opened). Version: Web page, no edition number. Licence terms were not read, so put it in your own words and do not quote it. Open the page and confirm what it says before relying on any detail. Supplement6November2026: actual current and archived2.x stubbing pages opened; priority then most-recent matching stub; reset paths also documented in2.x. V27 supplement, 6 November 2026: relevant primary page sections actually opened; implementation-specific current product guidance, not universal standard. See full V27 audit for version and access scope.

    8 November 2026: actual live WireMock Java Basic Stubbing and complete Stub Priority section/examples opened. Request mappings select configured responses; no installed-version or every-feature claim.

    WireMock topic review, 8 November 2026: Basic stubbing, stub priority, unmapped replies, reset and reset-to-default: current official page opened 8 November 2026. Local examples separately checked with WireMock Java 3.13.1.

    Version-specific correction: the general Reset paragraph says all mappings are removed, but WireMock Java 3.13.1 resetAll reloads defaults. See v945-wiremock-3131-reset-source and the local runtime tests. Do not infer an empty mapping list when files are present.

  2. Market practice

    Request matching (WireMock documentation) ↗ — WireMock · URL matching: path and query versus path only, plus request attributes. Current official page opened 8 November 2026.

    The WireMock matching pages say a stub can match on the address, the method, query parameters, headers, cookies and the body. Header entries use an operator such as contains. The body patterns list offers matchers for exact data equality and for paths inside a body. · Checked 2026-11-08

    Found through a web search; the page was not opened (search excerpt, page not opened). Version: Web page, no edition number. Licence terms were not read, so put it in your own words and do not quote it. Open the page and confirm what it says before relying on any detail. V27 supplement, 6 November 2026: relevant primary page sections actually opened; implementation-specific current product guidance, not universal standard. See full V27 audit for version and access scope.

    WireMock topic review, 8 November 2026: URL matching: path and query versus path only, plus request attributes. Current official page opened 8 November 2026.

  3. Market practice

    Simulating faults (WireMock documentation) ↗ — WireMock · Per-stub fixed delays and bad responses. Current official page opened 8 November 2026; delays are milliseconds and connection faults differ from status replies.

    The WireMock pages on faults describe a fixed delay in milliseconds on a response. They also describe a fault setting on the response with values such as an empty response, a malformed chunk and a connection reset. · Checked 2026-11-08

    Found through a web search; the page was not opened (search excerpt, page not opened). Version: Web page, no edition number. Licence terms were not read, so put it in your own words and do not quote it. Open the page and confirm what it says before relying on any detail. V27 supplement, 6 November 2026: relevant primary page sections actually opened; implementation-specific current product guidance, not universal standard. See full V27 audit for version and access scope.

    WireMock topic review, 8 November 2026: Per-stub fixed delays and bad responses. Current official page opened 8 November 2026; delays are milliseconds and connection faults differ from status replies.

  4. Market practice

    Verifying requests (WireMock documentation) ↗ — WireMock · Request journal, counts, unmatched requests, near misses and resetting the journal. Current official page opened 8 November 2026.

    The WireMock verifying pages describe a journal of received requests. The admin address lists them and counts matches. Unmatched requests and near misses can be listed. A delete call clears the journal. · Checked 2026-11-08

    Found through a web search; the page was not opened (search excerpt, page not opened). Version: Web page, no edition number. Licence terms were not read, so put it in your own words and do not quote it. Open the page and confirm what it says before relying on any detail. V27 supplement, 6 November 2026: relevant primary page sections actually opened; implementation-specific current product guidance, not universal standard. See full V27 audit for version and access scope.

    WireMock topic review, 8 November 2026: Request journal, counts, unmatched requests, near misses and resetting the journal. Current official page opened 8 November 2026.

  5. Market practice

    Running as a standalone process (WireMock documentation) ↗ — WireMock · Command-line options: bind address, no-request-journal and max-request-journal-entries. Current official page opened 8 November 2026.

    The WireMock standalone pages say the request journal can be switched off with a start-up flag and that the number of entries can be capped. Once the cap is reached, the oldest entries are dropped. · Checked 2026-11-08

    Found through a web search; the page was not opened (search excerpt, page not opened). Version: Web page, no edition number. Licence terms were not read, so put it in your own words and do not quote it. Open the page and confirm what it says before relying on any detail. V27 supplement, 6 November 2026: relevant primary page sections actually opened; implementation-specific current product guidance, not universal standard. See full V27 audit for version and access scope.

    WireMock topic review, 8 November 2026: Command-line options: bind address, no-request-journal and max-request-journal-entries. Current official page opened 8 November 2026.

  6. Market practice

    Stateful behaviour (WireMock documentation) ↗ — WireMock · Scenarios, Started state and POST /__admin/scenarios/reset. Current official page opened 8 November 2026.

    The WireMock pages on state say a scenario is a state machine that begins in the Started state. A stub names the state it needs and may set a new state. The scenario list is available at the admin address. · Checked 2026-11-08

    Found through a web search; the page was not opened (search excerpt, page not opened). Version: Web page, no edition number. Licence terms were not read, so put it in your own words and do not quote it. Open the page and confirm what it says before relying on any detail. V27 supplement, 6 November 2026: relevant primary page sections actually opened; implementation-specific current product guidance, not universal standard. See full V27 audit for version and access scope.

    8 November 2026: actual WireMock Java Scenarios section, Java/JSON example and reset operations opened. Models selected state transitions; not reproduction of an entire real service or actual WireMock execution.

    WireMock topic review, 8 November 2026: Scenarios, Started state and POST /__admin/scenarios/reset. Current official page opened 8 November 2026.

  7. Market practice

    Record and playback (WireMock documentation) ↗ — WireMock · Recording, snapshotting and generated mappings. Current official page opened 8 November 2026. Recordings capture observed interactions, not every possible service behaviour.

    WireMock can generate stub mappings from recorded or snapshotted calls. A recorded interaction is not a complete service contract. · Checked 2026-11-08

    Recording, snapshotting and generated mappings. Current official page opened 8 November 2026. Recordings capture observed interactions, not every possible service behaviour. No new live traffic was recorded for this lesson.

  8. Market practice

    Reset implementation in WireMock Java 3.13.1 ↗ — WireMock · WireMock Java 3.13.1 tagged ResetTask calls resetAll; WireMockApp resetAll calls resetToDefaultMappings, which clears mappings and requests then reloads defaults. Source opened and behaviour reproduced locally on 8 November 2026. This differs from the general Stubbing prose.

    Pinned implementation evidence for resetAll and resetToDefaultMappings; both clear requests and load default mappings. Not a claim about all versions. · Checked 2026-11-08

    WireMock Java 3.13.1 tagged ResetTask calls resetAll; WireMockApp resetAll calls resetToDefaultMappings, which clears mappings and requests then reloads defaults. Source opened and behaviour reproduced locally on 8 November 2026. This differs from the general Stubbing prose. Route task: https://github.com/wiremock/wiremock/blob/3.13.1/src/main/java/com/github/tomakehurst/wiremock/admin/tasks/ResetTask.java

Deepest material on this page: L4 — Standards & sources. Where a topic stops short of implementation depth, that is a deliberate coverage decision, not an oversight — see coverage.