STAFFPROJECTCHAPTER 31

Project: the test strategy for a payments product

Write six pages that say how Owoleaf's wallet is judged safe to release, and make every number in them trace to a command you ran

180 MINSOFTWARE TESTING AND QUALITYUPDATED 2026-11-24

You are Noor. Birgit will read what you write and sign it, so it has to survive her questions and the examiner’s. The deliverable is a document of at most six pages, STRATEGY.md, for the Owoleaf wallet’s payments products. The lab is labs/testing, Ojaline’s checkout service, used as a stand-in for the payments service. It is not Owoleaf’s code and this chapter never pretends it is. It is a small, honest model of a service that takes an amount in kobo, charges a provider, writes a record and retries safely, which is the core of a top-up. You measure it, and you write down what the measurements do and do not tell you about the real thing.

Five other chapters in this module teach parts of the strategy: A test strategy for a product, CI at scale: speed, sharding and test selection, Testing in production: canaries, flags and synthetic checks, Quality metrics that mean something and AI agents in the test loop: generation, triage and what to verify. If you have done them, use their results. If you have not, this project gives you every command you need from the lab as it ships, and says where a chapter’s evidence would make the document stronger.

What changes from the one-page strategy

A test strategy for a product taught the craft on Ojaline’s checkout service: a risk table, a level for each risk, a list of what is not tested, and exit criteria a script re-measures, all on one page. This project keeps that method and changes four things. The product is money held for customers, so the failure that matters is a wrong balance and not a slow release. The audience includes a regulator, so the evidence must be kept, dated and reproducible. There are three squads and a release owner, so gates have owners who may overrule them, and the overrule is recorded. And the page limit is six, so the strategy also covers what happens after release: the canary, the synthetic check and the daily reconciliation. If you did the earlier chapter, start from its STRATEGY.md and scripts/evidence.sh. The shortcuts are marked in the lab.

What the document is for

A strategy has three readers and each reads for something different.

The engineers read it to learn what they must not break and what they may skip. A strategy that says “we test everything” tells them nothing. One that says “money arithmetic is tested at every boundary on every commit, and the browser is tested once a night” tells a squad where to spend its next afternoon.

The release owner, Birgit here, reads it to find the gates: the list of things that must be true before a release goes out, and who may overrule them. Without that list, “is it safe?” is decided by whoever is shouting loudest on the day.

The reviewer, inside or outside the company, reads it to find the gaps. A regulator, an auditor or the partner bank’s risk team does not need the document to be perfect. They need it to be honest, and to show that the controls it names operated. For Owoleaf that means evidence made by the system at the time, kept where the team cannot quietly rewrite it. Testing money built that evidence for the reconciliation, and this document lists it.

So the document is an argument. It claims that this set of tests, gates and checks is enough for this product at this risk, and it supports each claim. Where it cannot support a claim it says so. Six pages is a hard limit because a strategy longer than that is read by nobody, and because a cut forces you to choose what matters.

The six pages

Spend the pages like this. Each section earns its length from who needs it.

Page Section What it must contain
1 Scope and risks The products covered, the money at stake in plain terms, and the five to eight risks you rank. Each risk names who is hurt.
2 Levels Which kind of test covers which risk: unit, integration, contract, end to end, plus what runs after release. The suite’s measured shape, in numbers.
3 Gates and flake budget What blocks a merge, what blocks a release, who may overrule and how that is recorded. The flake budget with an owner and a consequence.
4 After release The canary plan with its abort rules written before the release, the synthetic check, the daily reconciliation and what each can and cannot see.
5 Evidence pack and metrics The list of evidence a regulator can ask for, where each item is kept and for how long. Three metrics, each with its definition and what it must never be used for.
6 Limits and owners What is not tested and why, what the lab could not tell you, the owner of each section and the date the strategy is reviewed.

The order matters. Risks come first because every later section answers one. A level or a gate that answers no listed risk is ceremony, and a risk with no level is a gap you have chosen without admitting it.

Risks for a wallet

Start from what goes wrong with money, not from what is easy to test. For a wallet like Owoleaf’s, a first list looks like this. Add your own and cut what does not apply.

  • A customer is charged and not credited, or credited and not charged. This is the oldest complaint in payments, and the Payments course covers it in depth.
  • A retry takes money twice because an idempotency key was not honoured. The checkout lab has this shape: a lookup, then a charge, then a save, with a gap between them.
  • A rounding rule differs between two services, so the books differ by kobo that add up over a million transactions.
  • A provider times out and the service guesses wrong about whether the charge happened.
  • The daily reconciliation does not run, or runs on nothing, and reports a clean day.
  • A release changes the top-up screen and breaks it for a bank’s customers only, and nobody notices until support calls.
  • The examiner asks for last quarter’s controls and the team cannot show they ran.

Each risk gets one row in the table on page one: what it is, who is hurt, how likely and how costly, and the level that covers it. Be rough on likelihood and honest on cost. A risk you rate low must say why.

Evidence, not assertion

Every figure in the document comes from a file. The lab gives you five kinds of evidence, and each answers a question a reader will ask.

Suite shape and speed. How many tests of each kind, how long the gate takes. This answers “how fast do we learn we broke something?” The lab’s whole suite runs in about a second, which no real payments suite does. The number is a floor and not a forecast. What you can take from it is the shape: where tests sit and what they cover.

Thoroughness. Line and branch coverage say what the tests run. The mutation score says what they would notice. They disagree usefully. On checkout/pricing.py the starter suite has 92% coverage and a mutation score of 41%: 28 of 68 invented bugs caught. A strategy that quotes coverage alone is quoting the weaker number.

Flakiness. How often a test fails for no code reason. One flaky test among twenty-four is invisible in a count and visible in a loop. Flaky tests covers causes. Here you measure the rate and set a budget.

Behaviour under failure. What the service does when the provider declines, errors, hangs or answers slowly. You will write a small matrix for this. It answers “does a bad day leave the books right?” It does not answer “does a bad day leave them right in production?”, which only production can.

Bugs the suite would miss. The lab can seed a known bug and ask whether the suite fails. The starter suite catches 2 of 10. That is the most direct measure of whether the gate protects anyone.

What the lab can and cannot stand in for

This is the part of the strategy most often left out, and the one a reviewer trusts most when it is present. The checkout service is not the wallet. Write down, in your own words, a version of this table.

The lab can tell you The lab cannot tell you
The shape of a suite: tiers, counts, speed How long a real suite takes: a service of Owoleaf’s size runs tests for minutes, not a second
Whether tests would notice a change (mutation, seeded bugs) How many real bugs reach production: the lab’s ten were chosen by the course
A flake rate for one known test The flake rate of hundreds of tests written by many hands over years
That a provider 500, a decline and a timeout leave stock and orders consistent What a real provider does: late webhooks, duplicate callbacks, partial outages, changed fields
That a reconciliation can be run and an evidence file written A real settlement file from the partner bank, with its fees netted, cut-offs and chargebacks
That a synthetic check fails when the provider is down How a canary behaves against real traffic, with real variance and real seasons
Money in integer kobo, one rounding rule Cross-currency, tax and fee rules that change by regulation

Everything on the right is a gap in your evidence. It does not mean the strategy is wrong. It means the strategy needs a different source for it, and you name that source: the partner bank’s file, production monitoring, a quarterly game day. A strategy that quotes lab numbers as if they were Owoleaf’s is the document an examiner takes apart.

Gates and a flake budget

A gate is a promise that something you can check is true before work moves on. Write two lists: what blocks a merge and what blocks a release. The first must be fast and trustworthy, since a developer waits for it many times a day. The second can be slower and broader.

Keep three questions beside each gate. What does it check? How long does it take? Who may overrule it, and where is that recorded? A gate with no one allowed to overrule it gets bypassed quietly. One with a recorded override is a control you can show.

The flake budget belongs here because flakiness destroys gates. A test that fails for no reason teaches the team to rerun red builds, and a team that reruns red builds will one day rerun a real failure. State the budget as a number, for instance “no more than 1% of gating runs red for a non-code reason, measured weekly by rerunning the same commit”, and attach a consequence: past the budget, the owner quarantines the worst offenders before any new feature work. Google’s testing chapter argues that value erodes as flakiness nears 1%, which is where a budget like that comes from, but the number is yours to defend.

The lab gives you two figures to put beside it. The gating suite runs in random order every time and, in 20 runs, never went red for no reason. The single quarantined test, run in a loop, failed in roughly a third to a half of runs, varying from run to run. The first says the gate is trustworthy today. The second says what happens the moment someone un-quarantines that test without fixing it.

After release

Tests before release prove what you thought of. The rest of the strategy covers what you did not.

A canary sends a change to a small share of users first, compares its error rate and latency against the old version, and stops if they diverge. The strategy states the abort rules before the release, because a rule written during an incident bends toward whatever the team hopes is true. For example: abort if the canary’s error rate is more than 2 percentage points above the baseline over five minutes, or its p95 latency is more than 50% higher. Choose your own numbers and defend them. Testing in production covers the mechanism and has you run the comparison.

A synthetic check places a real test order on a schedule and fails when it cannot. It does not need traffic, which is its strength, and it only checks one path, which is its limit. The lab ships scripts/synthetic_check.py, and you will run it twice, once healthy and once with the provider broken.

The daily reconciliation is the control that catches what everything above missed: the books against the provider’s own record. Its evidence file is what an examiner asks for. If you wrote scripts/reconcile.py in Testing money, keep its evidence folder and list it. Its run with no data, and with the provider down, must be treated as a failure and not a clean day, and your strategy says who is paged.

Where a payments strategy goes wrong

The general failures (a list of tools, a strategy with no numbers, a metric used as a target, no review date) are in A test strategy for a product and Quality metrics that mean something. Three matter more here.

Borrowed numbers. Quoting a company’s published test pyramid ratio as your target. Use a published figure as a reference, name it, and give your own measured shape beside it. Google’s chapter suggests roughly 80% narrow tests, 15% medium and 5% end to end by count; yours should be a decision, not a copy.

No gaps. A strategy that lists nothing it does not cover reads as one that was not thought through, and a regulator will find the first gap for you. Every gap has an owner who accepted it and a signal that would make it matter.

A lab number presented as the product’s. The lab models one small service, not the wallet. Say so beside every figure.

LAB Measure the stand-in, then write the strategy ~180 MIN
YOU NEEDlabs/testing set up as in its README (Python 3.9 or later, `.venv` installed); no Docker, no browser neededA scratch copy of the lab, so edits and seeded bugs never touch your real checkout/Ports 8094 and 8095 free for step 6 (check with lsof first)About 180 minutes: 40 for the measurements, 100 for writing, 40 for the review

Work in a throwaway copy. From the folder that holds labs:

rsync -a --exclude .venv --exclude .playwright-browsers --exclude data --exclude mutants labs/testing/ scratch-strategy/
cd scratch-strategy
ln -s "$PWD/../labs/testing/.venv" .venv
export CHECKOUT_DB="$PWD/scratch.sqlite"
mkdir evidence

If you have no .venv yet, create one as the README’s Set up section says, inside scratch-strategy. Every command below runs from scratch-strategy, and every one writes its output into evidence/, so each number in your strategy can name a file.

If you did A test strategy for a product: you already have the measurements for steps 1 to 4. Copy your scripts/evidence.sh into scratch-strategy/scripts/, run it there, and move its evidence.txt to evidence/01-04-measurements.txt. It records the check time, whole-package coverage, the mutation score and flake rates over 50 runs, which is more runs than the 20 below. Still run step 2’s tier counts. Then go to step 5. Otherwise do steps 1 to 4 as written.

1. Record the environment and the baseline. The date and versions go first: a number without them cannot be repeated.

echo "lab run on $(date -u +%F), $(.venv/bin/python --version 2>&1), pytest $(.venv/bin/pytest --version 2>&1 | awk '{print $2}')" | tee evidence/00-environment.txt
/usr/bin/time -p ./scripts/check.sh > evidence/01-check.txt 2>&1
grep -E "passed|ALL CHECKS|^real" evidence/01-check.txt
lab run on 2026-11-23, Python 3.9.6, pytest 8.4.2
23 passed, 1 skipped, 1 deselected, 1 warning in 0.66s
ALL CHECKS PASSED
real 1.76

The whole gate, suite plus smoke test with both servers starting, takes under two seconds here. Your dates and times will differ. The skip is the browser test without Chromium, and the deselected test is the quarantined flaky one.

2. Measure the suite’s shape and speed. Count tests per tier, time a serial run and a parallel run, and take coverage for the whole package.

{ for t in unit integration extras e2e; do printf "%-12s" $t; .venv/bin/pytest tests/$t --collect-only -q -p no:randomly 2>&1 | grep -E "collected|^[0-9]+ test"; done; } | tee evidence/02-shape.txt
.venv/bin/pytest -q -p no:randomly 2>&1 | tail -1 | tee -a evidence/02-shape.txt
.venv/bin/pytest -q -p no:randomly -n auto 2>&1 | tail -1 | tee -a evidence/02-shape.txt
.venv/bin/pytest -q -p no:randomly --cov=checkout --cov-branch 2>&1 | grep -E "^(checkout/(pricing|orders|payments_client|api|legacy)|TOTAL)" | tee -a evidence/02-shape.txt
unit        10 tests collected in 0.01s
integration 6 tests collected in 0.15s
extras      7 tests collected in 0.01s
e2e         1 test collected in 0.23s
23 passed, 1 skipped, 1 deselected, 1 warning in 0.98s
23 passed, 1 skipped, 12 warnings in 3.70s
checkout/api.py                  83     22      4      0    72%
checkout/legacy.py               20     20      8      0     0%
checkout/orders.py               40      4     10      2    88%
checkout/payments_client.py      26     14      4      0    40%
checkout/pricing.py              61      3     14      3    92%
TOTAL                           442     79     66     10    80%

Two things for the strategy. The shape is 10 unit, 6 integration and 1 browser test, with 7 more that check the lab’s add-ons. And the parallel run is slower than the serial one, because starting workers costs more than a one-second suite saves. At Owoleaf’s real scale that reverses, and you say that in the limits section and not in the speed section.

3. Measure how thorough the tests are. Run the mutation tool on checkout/pricing.py and keep the survivors by function.

.venv/bin/python scripts/mutate.py run 2>&1 | tr '\r' '\n' | grep -E '[0-9]+/[0-9]+ ' | tail -1 | sed -E 's/^[^0-9]*//' | tee evidence/03-mutation.txt
.venv/bin/python scripts/mutate.py results | sed -E 's/__mutmut_[0-9]+//' | awk '{print $1}' | sort | uniq -c | sort -rn | tee -a evidence/03-mutation.txt
68/68  🎉 28 🫥 0  ⏰ 0  🤔 0  🙁 40  🔇 0
  25 checkout.pricing.x_price_cart:
   6 checkout.pricing.x_delivery_fee:
   5 checkout.pricing.x_line_total:
   3 checkout.pricing.x_promo_applies:
   1 checkout.pricing.x_discount_bp:

68 mutants, 28 killed (the party popper), 40 survived: a score of 41%, in about two seconds. 25 of the 40 survivors are in price_cart, the function that adds up what a customer pays. Against 92% line coverage this is the gap between running a line and checking it. Your score will match if you have not added tests. If you have, quote yours.

4. Measure flakiness. Run the gating suite 20 times in its default random order, then the quarantined test 20 times.

f=0; for i in $(seq 1 20); do .venv/bin/pytest -q >/dev/null 2>&1 || f=$((f+1)); done; echo "gating suite red in $f of 20 runs (random order each time)" | tee evidence/04-flaky.txt
f=0; for i in $(seq 1 20); do .venv/bin/pytest -m flaky -p no:randomly -q >/dev/null 2>&1 || f=$((f+1)); done; echo "quarantined test failed $f of 20 runs" | tee -a evidence/04-flaky.txt
gating suite red in 0 of 20 runs (random order each time)
quarantined test failed 7 of 20 runs

The gate was never red. The quarantined test failed 7 of 20 in this one run. Across all the runs taken while writing the course it failed about 35% to 60% of the time, varying from run to run, so quote a range and the number of runs. Twenty runs cannot tell 1% from 5%: say that beside any rate you quote. It takes about 25 seconds.

5. Ask whether the suite would notice a bug. The lab can apply ten known bugs one at a time. The wrapper prints only the count. Do not read seeded/README.md yet if you have not done the ten-bugs project: this step prints no names.

.venv/bin/python scripts/seed_bugs.py try | grep "caught by" | tee evidence/05-seeded.txt
.venv/bin/python scripts/seed_bugs.py status | grep -c clean
2 of 10 caught by tests/
10

The starter suite catches 2 of 10, in about 15 seconds. If you wrote the ten-bugs suite, point tests/ at yours and expect more. The second line must print 10: every patch is reverted. If it does not, run .venv/bin/python scripts/seed_bugs.py revert all and check again before going on.

6. Make the provider fail and record what the service does. Create scripts/fault_matrix.py. It places one order per provider mode and reports the status, the time, the change in stock and the number of charges the provider saw. It checks one rule: a failed order leaves stock as it found it, and a paid one takes exactly one unit.

"""Place one order per provider mode and print what the customer, the stock and the provider saw.

usage: fault_matrix.py [--api http://127.0.0.1:8094] [--provider http://127.0.0.1:8095]
Reads stock from the database in CHECKOUT_DB, so set it to the file the API uses.
Run it against a throwaway database: it places orders and takes stock.
"""
import argparse
import os
import sqlite3
import sys
import time
import uuid

import httpx

ORDER = {"lines": [{"product_id": 2, "qty": 1}], "distance_km": 3}
MODES = ["ok", "decline", "500", "timeout", "slow"]

def stock(db_path: str) -> int:
    """Units of product 2 on hand, read straight from the API's database file."""
    con = sqlite3.connect(db_path)
    try:
        return con.execute("SELECT on_hand FROM stock WHERE product_id = 2").fetchone()[0]
    finally:
        con.close()

def main() -> int:
    ap = argparse.ArgumentParser()
    ap.add_argument("--api", default="http://127.0.0.1:8094")
    ap.add_argument("--provider", default="http://127.0.0.1:8095")
    args = ap.parse_args()
    db_path = os.environ["CHECKOUT_DB"]
    httpx.post(f"{args.provider}/_admin/reset", timeout=5)
    print(f"{'mode':8} {'status':>6} {'seconds':>7} {'stock change':>12} {'charges':>7}  error")
    bad = 0
    for mode in MODES:
        httpx.post(f"{args.provider}/_admin/mode", json={"mode": mode}, timeout=5)
        before = stock(db_path)
        charges_before = httpx.get(f"{args.provider}/_admin/stats", timeout=5).json()["charges"]
        t0 = time.perf_counter()
        r = httpx.post(f"{args.api}/orders", json=ORDER, timeout=10,
                       headers={"Idempotency-Key": f"fm-{mode}-{uuid.uuid4().hex[:8]}"})
        took = time.perf_counter() - t0
        change = stock(db_path) - before
        charges = httpx.get(f"{args.provider}/_admin/stats", timeout=5).json()["charges"] - charges_before
        err = r.json().get("error", "") if r.status_code >= 400 else ""
        print(f"{mode:8} {r.status_code:>6} {took:>7.2f} {change:>12} {charges:>7}  {err}")
        # a failed order must leave stock as it found it; a paid one takes exactly one unit
        want = -1 if r.status_code == 201 else 0
        if change != want:
            bad += 1
    httpx.post(f"{args.provider}/_admin/mode", json={"mode": None}, timeout=5)
    print("stock invariant holds" if bad == 0 else f"STOCK INVARIANT BROKEN in {bad} modes")
    return 1 if bad else 0

if __name__ == "__main__":
    sys.exit(main())

Check the ports are free, then start the two services in two terminals as the README says. Run the matrix in a third, from scratch-strategy with CHECKOUT_DB set to the same file the API uses. Stop both services when it ends.

lsof -i :8094 -i :8095
.venv/bin/uvicorn fake_provider.app:app --port 8095        # terminal 1
.venv/bin/uvicorn checkout.api:app --port 8094             # terminal 2 (same CHECKOUT_DB exported)
.venv/bin/python scripts/fault_matrix.py | tee evidence/06-faults.txt   # terminal 3
mode     status seconds stock change charges  error
ok          201    0.02          -1       1  
decline     402    0.01           0       0  payment_declined
500         502    0.01           0       0  payment_unavailable
timeout     502    2.01           0       0  payment_unavailable
slow        201    1.02          -1       1  
stock invariant holds

A decline is an answer: 402, nothing charged, stock back. A 500 and a timeout both reach the customer as 502 with stock restored. The timeout takes 2.01 seconds, the client’s limit. Read the charges column for timeout: it is 0 because the fake provider hangs before it charges. A real provider can charge and then fail to answer, and the lab cannot show you that. That sentence belongs in your limits section.

7. Run the synthetic check healthy, then broken. With the services still up, run it, break the provider, run it again, repair it and run it a third time. Use curl for the mode.

{ .venv/bin/python scripts/synthetic_check.py
curl -s -X POST localhost:8095/_admin/mode -H 'Content-Type: application/json' -d '{"mode":"500"}' > /dev/null
.venv/bin/python scripts/synthetic_check.py
curl -s -X POST localhost:8095/_admin/mode -H 'Content-Type: application/json' -d '{"mode":null}' > /dev/null
.venv/bin/python scripts/synthetic_check.py; } | tee evidence/07-synthetic.txt

Then stop both services and confirm the ports are free with lsof -i :8094 -i :8095.

PASS 17 ms order placed and read back
FAIL 13 ms order returned 502 {'error': 'payment_unavailable', 'detail': 'provider returned 500'}
PASS 13 ms order placed and read back

Pass, fail with the cause, pass again. The check is a gauge your canary and your on-call can watch, and the middle line is what an abort rule fires on. It also takes stock and charges the fake provider every run, so a real synthetic check needs a test account the finance team can exclude.

8. Add the evidence from the earlier chapters, or mark it as missing. Each of these chapters ends by putting the lab back, so you probably deleted its files. Each file below can be recreated from its chapter, which prints the full code. Do it only if you have the time; otherwise mark the figure in the strategy as “not measured” and name the chapter. An honest gap is worth more than a borrowed number.

Evidence From File to recreate or keep What to run in scratch-strategy If you do not have it
Reconciliation run, with its evidence file Testing money scripts/reconcile.py .venv/bin/python scripts/reconcile.py "$CHECKOUT_DB" --provider http://127.0.0.1:8095 --out evidence/ against the scratch database, with the services up. Keep the JSON file it writes. Write “reconciliation: not measured (Testing money)” in section 5 and list the evidence it would produce.
Fault-injection runs Testing across services tests/integration/test_provider_faults.py and, for the seeded simulation, tests/sim_checkout.py FAULT_PROVIDER_PORT=8095 .venv/bin/pytest tests/integration/test_provider_faults.py -v; .venv/bin/python tests/sim_checkout.py 500 Step 6’s fault_matrix.py is the minimum. Say in section 6 that the late-charge case (provider charges, then times out) was not exercised.
Canary run with abort rules Testing in production scripts/canary_compare.py and canary_rules.json; for the flag, its edit to checkout/api.py Its steps 6 and 7 on the canary pair, ports 8594 and 8595, saving the output Write the abort rules in section 4 as numbers anyway, and mark them “not rehearsed”.

Copy what each run prints into evidence/ beside 06-faults.txt.

9. Write the strategy. Create STRATEGY.md from the skeleton, and fill every bracket. Cut anything that does not answer a listed risk. Keep to six pages: about 2,400 words with the tables, a little less if you use figures.

# Test strategy: Owoleaf wallet payments
Owner: Noor, quality lead. Approver: Birgit, head of payments engineering.
Reviewed: [date]. Next review: [date, at most 6 months].

## 1. Scope and risks
Covers: [card top-ups, NIP payouts, daily reconciliation, and what is out of scope].

| # | Risk | Who is hurt | Likelihood and cost | Covered by |
|---|---|---|---|---|
| R1 | [charged and not credited] | [customer] | [rough, with reason] | [level, gate or check] |

## 2. Levels and the suite we have
[Counts per tier, gate time, coverage, mutation score. Each figure: file name and date.]
[The shape we want and why, one decision per tier.]

## 3. Gates and flake budget
Merge gate: [what, how long, who may overrule, where it is recorded].
Release gate: [what, who signs].
Flake budget: [number, how measured, owner, consequence].

## 4. After release
Canary: [share, duration, abort rules written now].
Synthetic check: [path, interval, who is paged].
Daily reconciliation: [what it compares, what counts as failure, who is paged].

## 5. Evidence pack and metrics
| Evidence | Produced by | Kept where, for how long | Risk it supports |
|---|---|---|---|
Three metrics: [name, definition, source, decision it informs, never used for].

## 6. Limits and owners
What the stand-in could not tell us: [one row per gap, its source of truth, owner].
What we do not test, and who accepted it: [...]
Owners by section: [...]

## Appendix: evidence index
[Each figure, the file in evidence/, the command, the date.]
A document of no more than six pages. Every figure in it has a line in the appendix pointing at a file in evidence/. Risks R1 to R7 each appear in at least one later section. The limits section names at least four things the lab could not tell you and says where the real answer will come from. Page one does not mention any tool.

10. Review a peer’s strategy against this rubric. Swap with a peer, or read yours cold after a day. Mark each line pass, partly or fail, with the sentence that earns it.

# Check Pass when
1 Every risk has a level Each row in the risk table points at a gate, level or check in a later section, and no later section answers a risk that is not listed.
2 Figures trace Every number has a file, a command and a date in the appendix. A spot check of three finds all three.
3 The stand-in is honest The limits section says what the lab could not tell, and no lab number is presented as Owoleaf’s.
4 Gates have owners Each gate says what it checks, how long it takes and who may overrule it.
5 The flake budget bites It has a number, a way of measuring, an owner and a consequence.
6 Abort rules come first The canary section states its abort rules as numbers, before any release.
7 Failure counts as failure A reconciliation that did not run, or ran on nothing, is a failure with someone paged.
8 Gaps are named At least three things are marked as not covered, each with an owner who accepted it.
9 Metrics have limits Each metric says what it informs and what it must never be used for.
10 It fits Six pages or fewer, and a new engineer could say after reading it what they must not break.
A marked-up copy for each document: a pass, partly or fail on every line, and the one sentence a reviewer would change first. Expect lines 3 and 8 to be the common fails on a first draft: the document quotes lab numbers as if they were Owoleaf’s, and lists no gaps.

Break it. Test the strongest sentence in your strategy by trying to falsify it. If it says a failed payment leaves the stock as it found it, break that on purpose. In checkout/orders.py of your scratch copy, replace the release_all(db, lines) line in the finally block with pass. Run .venv/bin/pytest -q -p no:randomly, then restart the API and run scripts/fault_matrix.py again. On the lab here the suite failed one test, test_declined_payment_puts_the_stock_back, and the matrix printed STOCK INVARIANT BROKEN in 3 modes: decline, 500 and timeout. The suite covers only the decline path. Ask what your strategy says about the other two failures, and whether the sentence you wrote is backed by a test that would have gone red. Restore the line from your copy of the lab when you are done.

11. Put the lab back. Everything you did ran in scratch-strategy, so the real lab is untouched. Copy STRATEGY.md and evidence/ somewhere you will keep them, stop any server you still have running, then delete the scratch copy. Deleting it removes the .venv symlink and not the environment it points to.

lsof -i :8094 -i :8095
cd ..
cp -R scratch-strategy/STRATEGY.md scratch-strategy/evidence ./ 2>/dev/null
rm -rf scratch-strategy
git status --short labs/testing
lsof and git status --short labs/testing print nothing. If the real lab’s .venv is missing afterwards, you created it inside the scratch copy and need to install it again.
READING
  1. DOC
    Heuristic Test Strategy Model James Bach, 2024

    Version 6.3 (December 2024): guide words for project elements, product factors and quality criteria. Use them as a checklist on your risk table, to find the risks you forgot. Do not try to fill every cell. Read 2026-11-24.

  2. BOOK
    Software Engineering at Google, chapter 11: Testing Overview Adam Bender, 2020

    The source of this project's two Google figures: a rough mix of 80% narrow, 15% medium and 5% end-to-end tests, and the remark that tests lose value as flakiness approaches 1%. Read it to defend your own numbers against them. Read 2026-11-24. Read: the sections on test scope and size, and on flakiness.

  3. BOOK
    Testing for Reliability, Site Reliability Engineering, chapter 17 Alex Perry and Max Luebbe, 2016

    Why a test that blocks a release removes a bug at zero time to repair, and which checks belong after release. Use it for section 4 of your strategy. Read 2026-11-24. Read: the sections on traditional tests and production tests (configuration, stress and canary); skip creating a test and build environment.

  4. POST
    Designing robust and predictable APIs with idempotency Brandur Leach, Stripe, 2017

    A payments company's account of why a retry after an unclear failure can charge twice, and how an idempotency key makes a retry safe. It is the background to your second risk and to the retry behaviour the fault matrix checks. Read 2026-11-24.

All companies and people in these examples are fictional. Any resemblance to a real business or person is unintended.

RECALL CARDS Tap to flip. They join your review deck when you mark the lesson complete.
NEXT: A history: from debugging to test-driven development to chaos →