Test Once, Measure Always

Tests prove known cases before release. Measurement tells you what reality is doing after release.

Happy-path tests prove the system works when nothing goes wrong. Failure testing proves it survives when things do. Observability keeps checking that claim in production, where the world is larger than your test suite.

Start with a hypothesis:

This checkout flow does not double-charge, double-fulfill, or strand paid users.

Then try to disprove it.

Test the Unhappy Paths #

Fault Injection #

For checkout, simulate Stripe timing out after the session was created, a webhook arriving twice, fulfillment failing after payment succeeds, and the success page loading before the webhook arrives.

Chaos Engineering #

Boundary & Property Testing #

Recovery Testing #

Measure the Same Claims #

You cannot test every real-world failure. You can measure whether the important claims are holding.

These measurements are not vanity metrics. They are production tests that run all the time.

Logs, Metrics, and Traces #

Log at boundaries and decisions: session created, webhook received, duplicate ignored, fulfillment retried, reconciliation repaired an order. Avoid noisy logs that say little, and never log secrets or unnecessary personal data.

Close the Loop #

Every incident should leave the system sharper:

Front End vs. Back End Notes #


Related chapters: Failure Modes · Do or Do Not. Then Retry. · Writing Insanely Great Error Messages