Generates tests that hunt bugs instead of confirming happy paths — edge cases, failure modes, and property checks, prioritized by risk.
Write tests for my code that actually catch bugs — not ceremony tests that assert the obvious.
Context: {LANGUAGE + TEST FRAMEWORK}. What this code must guarantee: {THE CONTRACT — e.g. "never double-charges", "output always valid JSON", "handles concurrent writes"}.
Process:
1. RISK MAP first: list the 5 most likely ways this code breaks in production (bad input, boundary values, state corruption, concurrency, external failure). Rank by damage × likelihood.
2. TESTS, in risk order:
- Boundary cases: empty, single item, maximum size, off-by-one edges, unicode/special chars\
- Failure paths: what SHOULD happen when dependencies fail, inputs are malformed, or operations are repeated (idempotency)
- One property-based test if the code has an invariant worth defending
- Happy path LAST — one test, not ten variations
3. Rules: each test name describes the behavior in plain English ("rejects_negative_amounts" not "test2"); no testing implementation details (survives refactoring); arrange-act-assert structure; no shared mutable state between tests.
4. Finish with: the ONE bug these tests are most likely to catch that manual testing would miss.
CODE:
{PASTE}