Documentation
Every page of docs/: the guides, one page per tool, one per product, the demo scripts. The pages stay in the repository, reviewed with the code.
Clicking a page shows it; a link to another page opens it here. Each tool keeps its blue box for the page itself, and its 📖 Documentation link, top right, opens its full page here.
docs/recordings.md
Recorded examples: real calls and real events, replayed by the tests
Disclaimer: this is a personal demo project, not a source of truth or a reference implementation. It reflects my own understanding and choices: its content remains subjective, despite the quotes and references it contains. It may be incomplete, simplified, inaccurate or outdated, and it is not meant for production use. Always check the official documentation before applying anything from it. Provided as is, without any warranty: you use it at your own risk.
A test that replays a hand-written example only proves the code agrees with its author. This project records what the neighbours really say, keeps the transcript, and turns it into the examples the tests replay against throwaway containers. The Quality Console lists every recording in Tools, Recorded examples, right after API docs.
TL;DR
- Two recordings: the Bank Partner answers (HTTP, a third party) and the order workflow events (RabbitMQ, our own services).
- Each has a journal in
capture/(the raw transcript, not committed) and examples incontracts/(merged from the journal, committed, reviewed in a diff).- Partner:
mise run partner:up,mise run capture:examples,mise run capture:merge. Events:mise run up,mise run capture:events,mise run capture:events-merge.- The storefront itself records nothing: its cards produce the traffic, the capture commands record it.
Prism or Microcks?
Not rivals, two jobs on the same contracts/:
| Contract mocks (Prism) | Microcks | |
|---|---|---|
| For | anyone trying an API by hand, a team waiting on another | the integration tests |
| Answers from | the contract alone: one example per operation | the recorded examples: the answer picked by request |
| Runs | mise run up, http://localhost:4010 |
testcontainers or a CI sidecar, never in the console |
| In the console | the 🎠links of API docs, the Contract mocks (Prism) card | Recorded examples |
What a recording is for
Three steps, the same for both recordings:
- Record against the real thing: the partner as it answers today, the broker as our services use it.
- Merge the transcript into examples: only that file changes, so a reviewer reads the difference ("the bank now answers another balance") before it is committed.
- Replay in the tests, against containers: Microcks serves the partner's recorded answers to the real HTTP client; the order workflow test compares the events the code publishes with the recorded ones.
Writing a test that uses a recording: by hand, follow the README ("Recording what the partner answers", then "Adding an API endpoint and its tests"); with Claude Code, /new-api-test reads the same conventions.
The Bank Partner answers (HTTP)
- Recorded from the fake partner on http://localhost:8090 (
mise run partner:up),GET /balancefor every username oftests/story.py. - Journal
capture/journal.json, one record per username: request, status, body. - Examples
contracts/bank-partner-examples.yaml: the200examples come from the journal, the404(unknown-account) is written by hand, since a capture only records success stories, and the merge never touches it. - Replayed by Microcks in
test_hello_balance_microcks.pyand in the browser test.
The order workflow events (RabbitMQ)
- Recorded from the broker of
mise run upthrough its firehose:rabbitmqctl trace_oncopies every published message toamq.rabbitmq.trace; the capture binds a queue to it, places one order per story through the storefront, and keeps the events of that order with the milliseconds since it was placed. The task switches tracing off at the end. - Stories:
paid-order(ada buysBK-0004) andout-of-stock-order(grace buysEL-0001). - Journal
capture/events-journal.json; examplescontracts/order-workflow-recorded.yaml, the workflow id replaced by<workflow_id>since it changes at every capture. - Replayed by
test_orders_rabbitmq.py: for each story, the same order is placed against a RabbitMQ container and the events the code publishes must have the recorded types, in the recorded order, with the recorded fields.
The broker port 5672 is published by docker-compose.yml for the capture; the account is guest / guest.