My tests only cover the happy path, never the boundaries
In one sentence: most of the tests I write for you verify that "it works when everything is fine." Empty collections, null, oversized input, concurrency, timeouts, error branches — the places bugs actually live — I often never touch. A wall of green tests gives you the illusion of coverage, not the fact of robustness.
Symptom
You ask me to "add tests for this function." I hand you a set in seconds: typical input, assert the typical output, all green. The coverage number ticks up, and you merge with confidence.
But count what I actually tested. I tested parsePrice("¥1,299.00"); I never wrote parsePrice(""), parsePrice("1.2.3"), parsePrice(null), negative numbers, or huge numbers. For the pagination function I tested "page 2 has data" but not "page number is 0," "page exceeds the total," or "the list is empty." I covered the happy path airtight and left the boundaries and error branches almost blank.
Why this happens
Starting with typical inputs can omit failures, especially when the specification leaves exceptional behavior unstated. This risk does not establish training-data proportions or that every model never writes boundaries without reminders.
Claude Code recommends verifiable success criteria and concrete edge examples. Our practical recommendation is to establish equivalence classes, boundaries, and error contracts, then choose cases by risk rather than attempting unlimited enumeration.
Consequences
- Coverage becomes false evidence. High line coverage doesn't mean those lines were verified under boundary input — it only means the line ran once. Treating coverage as the "enough" signal is being misled by exactly that number.
- The most bug-prone spots have zero tests. Defects naturally cluster around boundaries and error handling, which is precisely what I skipped. The reassurance of green tests papers over the highest-risk area.
- Problems get deferred to more expensive stages. Empty input, concurrency, and timeouts that the tests never surface will surface during integration, in a canary release, or in production — where locating and fixing them costs several times more.
- Illustrative external-corpus gap. Suppose an initial eight cases all pass, but an expanded set passes only nine of seventeen. New failures could all concern an untested reason enum. The first score supports only the first set; these example counts are not research measurements.
What to do instead
Don't let me "just handle it" when adding tests. Force me to list the boundaries and error paths first, then write one test for each. Order matters: list first, write second, look at coverage last — and only treat coverage as a map of "what hasn't been tested," never as a certificate of "tested enough."
Concretely, ask me like this:
Don't write tests yet. List every boundary condition and error path for this function:
empty input / null / oversized / out of range / malformed format / concurrency / timeout /
permission failure / each exception branch.
Partition by equivalence classes and boundary values, then write one test per class,
including what each failure should throw.
A few levers that make this stick:
- Name the failure branches explicitly. "Write a test for every path that throws" — inspect actual coverage rather than assuming that listing a branch in the prompt tested it.
- Use equivalence partitioning / boundary-value methods. Have me slice the input space into classes and pick representative and boundary values for each, instead of grabbing a single "normal value."
- Write tests first, implementation second (see trust, then verify). Have me write tests that include boundary cases, confirm those cases are reasonable, then have me make them green — while still checking the expectation and whether the target path actually ran.
- Treat coverage as a map, not a trophy. Look at "which branches were never executed," not at whether the percentage is big enough.
Example
Before:
You: add tests for parsePrice(str)
Me: (writes three tests, all normal values)
parsePrice("¥1,299.00") === 1299
parsePrice("100") === 100
parsePrice("0.5") === 0.5
You: (coverage 90%, merge)
Production: parsePrice("") throws; parsePrice("1.2.3") returns NaN and lands in the bill
After:
You: Don't write tests yet. List parsePrice's boundaries and error paths, by equivalence/boundary value.
Me: empty string, all-whitespace, multiple decimal points, minus sign, huge number,
contains illegal characters, null/undefined, currency symbol with no digits...
You: Good. Write one test per class. Illegal input should throw InvalidPrice, not return NaN.
Me: (writes the tests; the ones for "" and "1.2.3" fail immediately)
You: Now fix the implementation so they all pass.
Me: (iterates to all-green; the boundaries get forced out one by one)
Same function: "add tests" yields a green illusion of the happy path; "list the boundaries first, then write one test per class" yields tests that actually touched the painful spots.
When the exception applies
Testing the boundaries is the default, but in a few cases covering only the happy path is a reasonable trade:
- A throwaway spike or prototype: a demo thrown together to check whether an approach is viable — it never ships and gets deleted after use, so one smoke test through the happy path answers your question, and filling in the boundaries is running a physical on code you're about to discard.
- The boundaries are already guarded elsewhere: this function's input is validated upstream, or the type system already blocks invalid values, so re-testing the same boundaries at this layer is redundant — as long as that line of defense genuinely exists and is itself tested.
- You want the thinnest regression anchor: pin a single happy-path case onto untested legacy code to catch "the whole thing broke" level regressions — that's a zero-to-one step, not the finish line.
The test: the exception holds when this code either won't outlive this one use (throwaway) or has its boundaries covered elsewhere. The moment it ships and is the only guard on the bug-prone boundary/error paths, fall back to the default: list the boundaries first, then write one test per class.
Version notes
Official practice supports explicit boundary validation, not a universal model tendency or stronger-model trend. Coverage, case counts, and all-green results do not establish exhaustive verification. Recheck changed input contracts and operating conditions.