Review AI-generated tests against the requirement
Review AI-generated tests with worked assertions, a known-defect exercise and a checklist for requirements, boundaries and actual run evidence.
When you review AI-generated tests, start with the requirement beside the test diff. A passing check can confirm that a field exists while leaving the wrong export quantity untouched. Ask which incorrect result would make the check fail.
This guide uses a fictional warehouse dispatch export to compare weak and useful assertions. It gives you a test-review worksheet and a way to challenge a passing result. The example is a teaching model, not a shipped feature or a customer incident.
Review AI-generated tests against an agreed example
Suppose the approved rule says an export contains the quantity still to ship. For an approved line with 10 units ordered and 4 shipped, the file must contain 6. Fully shipped lines must be absent. A lead may export only a warehouse they manage.
Record expected results before reading the implementation. If the agent derives an expected value from the same helper that produces the actual value, both sides can repeat the same mistake. Ask the business owner to settle ambiguous rules, such as how partial cancellations affect the balance.
Google's testing guidance recommends testing public behaviour rather than exposing implementation details. For this export, inspect the downloaded file and its contents. The following example applies that principle to one quantity rule.
Compare what the assertions can detect
These Python excerpts describe a deliberately small model. Its executable source and run record accompany the article's editorial materials. It returns a row; it does not implement authentication, a database or CSV download.
def export_row(ordered, shipped):
return {"sku": "BRACKET", "outstanding": ordered}
# Weak: accepts the incorrect quantity 10.
row = export_row(10, 4)
assert "outstanding" in row
# Useful: expected value comes from the agreed example.
assert export_row(10, 4) == {
"sku": "BRACKET", "outstanding": 6
}The defect is the use of ordered without subtracting shipped units. The weak assertion passes because the field exists. The expected-row assertion fails because 10 differs from 6. Repairing the expression to ordered - shipped makes that assertion pass.
A check that a helper was called may still serve a specific integration contract. It supplies limited evidence about the exported quantity. Keep an outcome check at the existing download seam, and use narrower tests where they help isolate a calculation or failure.
Challenge a passing test with one known defect
In an isolated working copy, temporarily restore a plausible mistake: export ordered quantity instead of outstanding quantity. Run the relevant test unchanged. Confirm it fails at the quantity assertion, then restore the correct implementation and rerun. Keep the defective version out of the product.
We ran this exercise against the teaching model with Python's standard unittest runner. Each cell reports a separate one-test run. These are local example results, not results from a production export.
| Model version | Column-presence test | Expected-row test |
|---|---|---|
| Defective: returns ordered quantity | 1 test, OK | 1 test, FAILED (failures=1) |
| Corrected: subtracts shipped quantity | 1 test, OK | 1 test, OK |
The failure demonstrates sensitivity to this particular defect. It establishes nothing about warehouse isolation, empty files or CSV encoding. Inspect why the run failed: an import error or broken fixture would not show that the quantity assertion caught the defect.
Check boundaries the model leaves out
For a real export, map each requirement to an observable assertion through the application's existing seams. Use records that make accidental inclusion or exclusion visible.
| Requirement | Setup | Evidence to inspect |
|---|---|---|
| Remaining quantity | 10 ordered, 4 shipped | Parse the actual file; assert this line's quantity equals 6. |
| Exclude completed lines | A distinct line with all 5 units shipped | Assert that reference is absent, alongside the included line. |
| Warehouse boundary | A lead assigned to A; a valid B with distinct records | Direct B request gets the agreed denial response; B's references are absent from the A file. |
| Empty result | An authorised warehouse with no eligible lines | Check headings and zero data rows, rather than only a successful status. |
| Read-only download | Known order and stock records | Check relevant persisted values remain unchanged after downloading. |
These are proposed checks for the fictional specification. Adapt the denial response and output contract to the approved design. An authenticated request test should exercise the permission boundary; a mock that grants access cannot establish it.
Inspect changes that make a suite pass
Read the test diff beside the product diff. If a test previously expected 6 and now expects 10, ask which approved requirement changed. An implementation change alone does not justify changing the expected business result.
- Reduced assertions: replacing an exact parsed row with a status check loses evidence about file contents.
- Skipped checks: record the reason, owner and condition for restoring them. A skipped boundary remains unverified.
- Convenient fixtures: zero shipped units cannot distinguish ordered from outstanding quantity.
- Excessive mocking: replacing the query or exporter with a prepared answer can bypass the behaviour under review.
- Narrow runs: confirm the command and filters, including related checks excluded from the run.
If the original test was wrong, record the corrected requirement and evidence. Preserve useful regression cases. Add tests for distinct risks or requirements; a larger count alone supplies no acceptance decision.
Leave a short review record
Use this worksheet with the agent's completion report so a reviewer can find the agreed result and actual run.
Requirement and approved revision:
Representative input / actor:
Expected observable result and its source:
Test file and named case:
Known defect challenged, if appropriate:
Observed failure and reason:
Restored implementation and actual rerun:
Command, revision, environment and output location:
Skipped checks / uncovered boundaries:
Reviewer decision and remaining work:Our AI agent development workflow keeps implementation and review as separate steps, with a person responsible for acceptance. This worksheet gives that reviewer evidence about test quality. It can accompany a broader AI-assisted delivery review.
For your next change, choose one important acceptance example and identify a plausible defect its test should catch. Inspect the assertion, the failure and the repaired rerun. Record remaining boundaries before making the merge decision.
Start with a paid Blueprint, not a guess
One to two weeks to agree the scope, the risks and the measure of success — then a fixed price for the Build.