TOPIC 15/1716 MINNOT STARTED

WireMock part 1: run it and write a first stub

Start WireMock on your own machine, save one mapping file with a request and a response, and call it with curl to see the answer you wrote.

L1–L4 are part of the Pro pass

L0 Explain simply

Analogy: a vending machine with a button code. You press a code and the same snack drops every time. The machine does not call a real shop. You stock it by loading a tray.

Tom is a tester at Daily List, a to-do list app. The real tasks service is slow and often busy. He needs one answer that does not change.

What it is: WireMock is a free tool that pretends to be an HTTP (Hypertext Transfer Protocol) service. You run it on your own machine. A is a small (JavaScript Object Notation) file with a request part and a response part. JSON is text with curly brackets and names in quotes. A WireMock start folder is where the server looks for a mappings folder and a __files folder. The WireMock admin address is a set of paths that start with /__admin. Those paths control the server. They are not the pretend API (application programming interface). WireMock is not the real tasks service. A stub answers what you wrote. It does not prove the real service is well.

Why it matters: A slow or busy partner blocks tests. Tom can start WireMock and write one stub so the tests get a stable answer. If he points the tests at the real partner instead, the run fails for reasons he does not control.

PLAIN WORDS · 3 in this section
vending
selling goods from a machine
hypertext
text that links to other pages
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 Register a valid stub and inspect admin state.

  1. Code
  2. Tray
  3. Snack
Vending machine

HOW THE PICTURE MAPS

How each part of the picture matches the software
In the pictureIn the software
The button codeThe request
The snack that drops outThe response
The tray you loadThe mapping file
The panel that lists the stockThe admin address

WHERE THIS PICTURE STOPS

  • A snack is real, but a stub answer is only written text.
  • A machine stocks itself, but you load every mapping.
  • A tray is fixed, but a mapping can be changed.

HOOK

Code in, snack out.

TELL A FRIEND

A code, a tray and a snack.

OFTEN MIXED UP WITH Service virtualisation with WireMock. That topic explains why a helps. This one starts WireMock and writes the first stub by hand.

PRACTISE AND KEEP

Sources for this topic — 2 sources
  1. Implementation-specific

    Stubbing (WireMock documentation) ↗ — WireMock · Current Stubbing: request/response mapping, priority lower number/default5/latest matching at equal priority, explicit save mappings endpoint; opened6 November2026.

    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. Implementation-specific

    Running in Docker (WireMock documentation) ↗ — WireMock · Current Docker documentation example3.13.2: mounted mappings/__files under /home/wiremock; ephemeral --rm versus host storage; opened6 November2026.

    The WireMock Docker pages show a docker run command that publishes port 8080. They say the admin address shows the loaded mappings, which start empty. A mounted folder can supply mapping files. · Checked 2026-11-06

    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.

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.