A common release review scenario: the test report shows intent coverage rising from sixty percent to nearly ninety percent, API success rates stable, and the team prepares to ship. In the first week after launch, the customer service assistant states the refund policy incorrectly, and the ticket assistant promises a reshipment without querying the order. Checking back against the test set, these scenarios were all “covered,” and the test cases were indeed executed—only the assertions were written as returns non-empty, contains “refund” or “reshipment.”
A rise in coverage is not progress in itself; it only means more requests were sent. For AI systems, what really determines whether tests can stop incidents is assertion quality. High coverage with weak assertions is more dangerous than low coverage, because it disguises unknown risk as known safety. Low coverage at least makes people uneasy; an inflated green light makes people confident enough to release.
Coverage counts “touched,” not “judged”
Traditional code coverage has a clear denominator: lines, branches, functions. In AI applications, code coverage is still useful, but it mainly covers the orchestration layer: whether a request enters routing, whether the tool client is called, whether exception branches are reached. Code coverage cannot touch a single bit of the semantics of model output, whether tool parameters are reasonable, or whether the system refuses when it should refuse.
The three common coverage measures in test reports show different things:
| Coverage measure | What it counts | What it easily misses |
|---|---|---|
| Code lines or branches | Whether orchestration code executes | Model semantics, tool parameters |
| Intent or scenario | Whether test set labels have run | Long tail outside labels, condition combinations |
| Tool or workflow | Whether tools are called | Call order, permissions, amount boundaries |
All three measures answer only “was it touched,” not “was it judged.” A test case’s request went out, a response came back, and the JSON parses—this only proves the service is not down. It is closer to a smoke test than a behavior test. When a team has thousands of such cases, coverage can rise quickly, because the cost of adding a case is extremely low: copy an input, change the wording, assert non-empty.
Inflated green lights usually come from three shortcuts
One shortcut is splitting test cases. Split the same intent into multiple variants; the denominator and numerator rise together while the risk surface does not change. The report looks more comprehensive, but in reality it just copies the same assertion more times.
Another is loosening assertions. From task success down to format correctness, from factual correctness down to keyword presence. Keyword assertions are easily circumvented by the model: the answer contains “refund,” but it may be saying “cannot refund.”
The third is letting the model act as judge without calibration. Semantic review looks like it can fill the gap for open answers, but if the judge comes from the same source as the model under test, the prompt is loose, and there is no human-labeled calibration, it will judge “sounds right” as “did it right.” This kind of false positive does not slow tests down; it only loosens the gate.
The three shortcuts share one trait: they all increase execution, not falsifiability. Coverage is a proxy for execution volume; assertions are the proxy for the failure surface. Treat the former as the goal, and teams will naturally choose the lowest-cost way to raise it.
Assertions must write falsifiable failures
An assertion is not a restatement of requirements; it is writing down a kind of failure in advance. For AI output, exact matching against a standard answer is usually infeasible, because one query may have multiple correct answers. A more robust approach is to write invariants: no matter how the answer is organized, which facts must hold, which actions must occur, and which promises must not appear.
| Assertion level | Question to answer | Example |
|---|---|---|
| Structure | Can downstream consume it | JSON schema, required fields, enum values |
| Fact | Does what is said match the material | Amounts, dates, policy clauses consistent with retrieved snippets |
| Behavior | Were the right actions done in order | Query order before refund; refund amount does not exceed order amount |
| Boundary | Did it refuse when it should | Privilege escalation, over threshold, missing parameters escalate to human |
Take the refund assistant as an example. A weak assertion is that the answer contains refund. A strong assertion must at least govern action order, amount caps, and escalation to human on privilege escalation.
1 | case: refund_without_order_lookup |
This configuration is not a complete test framework; it expresses a set of falsifiable constraints: if a refund is called without first querying the order, the test should go red; if the refund amount exceeds the order amount, the test should go red; if the threshold is exceeded without escalation to human, the test should go red. Only when assertions can be written does a test deserve to be called coverage.
Calibrate the false negative rate of model review first
Open answers cannot do without semantic review, but the judge cannot be trusted by default. The calibration method is not complicated: prepare a batch of samples known to be good and known to be bad, let the judge score independently, and count the two errors separately. Judging bad as good is a false negative; judging good as bad is a false positive. Release gates should look at the false negative rate first, because false negatives directly create false green; false positives cost extra manual effort, false negatives let more incidents through.
My current default practice is: if the judge passes more than ten percent of a batch of dozens to hundreds of known bad cases, it does not enter the blocking gate yet and only ranks cases before manual review. This threshold is not an industry standard; it is the missed-release cost I am willing to bear. For high business risk, the threshold should be tightened further; for internal drafts only, loosening is fine.
Same-source bias must also be guarded against. When the model under test and the judge come from the same family, answers with similar expression styles are more likely to score high. One mitigation is for the judge to look only at verifiable evidence, such as retrieved snippets, tool returns, and policy clauses, rather than only the answer text. Another is to keep some human blind evaluation and regularly spot-check the judge. Full judging is costly and unnecessary; stratified sampling is enough.
Coverage should be a radar, not a trophy
The most valuable use of coverage is finding blind spots: which intents have no cases, which tool combinations have not run, which boundary conditions are not covered. It is not suitable as a standalone release gate, because once a threshold is attached, teams will optimize the number.
A more robust approach is to change the numerator of coverage: count only cases with effective assertions. Cases without assertions are called probes, not coverage. An effective assertion must satisfy at least two points: it goes red if the target output is wrong; when it fails, it can point out which layer is wrong—structure, fact, behavior, or boundary.
An even harder step is reverse verification. After writing an assertion, break the correct output once and see whether the test goes red. Change a field, change an amount, delete a citation, swap tool order—change only one point each time. If the test is still green, the assertion is decoration. This action improves gate credibility more than adding a hundred more cases.
Release gates can be layered by risk: all blocking-level assertions pass, semantic review is sampled by risk, and long-tail issues go into online monitoring. When an issue leaks online, the first question in the retrospective is whether a case was missing or an assertion was missing. Missing cases means add scenarios; missing assertions means add constraints. Many teams add case counts as soon as they see an incident, resulting in higher coverage and the same leaks next time.
Reviewing a test case can go through these five questions:
- What does the failure corresponding to this coverage point look like
- Will the assertion go red on wrong output
- Does it belong to structure, fact, behavior, or boundary
- Has the false negative rate of semantic review been calibrated
- In retrospectives of similar online issues, was a case or an assertion added
When coverage is still useful
Coverage is not useless; it has clear applicable boundaries. When the system is still in exploration, with few cases and unclear failure modes, coverage can serve as a map to help the team discover which kinds of requests have never been tested. In execution-path-intensive scenarios such as fuzzing, protocol compatibility, and tool integration, high coverage can indeed rule out a batch of low-level errors.
But once coverage becomes a release gate, a team KPI, or a weekly report highlight, it starts to distort. What matters more at that point is assertion quality, the miss rate, and defects that escape to production. A rough heuristic: if coverage rises fast but production incidents don’t fall, the new test cases’ assertions probably haven’t kept up. Don’t celebrate yet—pull ten new test cases, break their output, and see how many turn red.
At your next test review, ask one question first: if this test case got the answer wrong, which assertion would turn red? If no one can answer, it has only been executed, not verified.
Comments