Fake the inputs that make a test safe and repeatable, while keeping the behavior under examination real. If an agent is supposed to save a report, a test that replaces the save operation with a success message can verify the agent’s response to that message. It cannot establish that a report was stored.
Use this reference to ask what each passing test demonstrates. “Real” means that the relevant implementation runs in a controlled environment; it does not require customer data or live commercial effects.
- 01Choose the claim first.Decide whether the test examines an interface, a calculation, a permission boundary or a persisted outcome.
- 02Label every substitute.Record which inputs, tools and responses were supplied by the test instead of the system.
- 03Inspect the resulting state.A success-shaped message is weak evidence when the claimed result is a file or record elsewhere.
01 — Match each test case to a bounded claimMatch each test case to a bounded claim
A mock is a controlled replacement for part of the system. A fixture is a prepared input or starting state. Both are useful. The table identifies what must remain exercised for the named test to mean anything, then names the claim that still needs separate evidence. Rows are choices for test design, not a ranking from bad to good.
| Test case and group | Controlled setup | What stays real and what remains unproven |
|---|---|---|
| Inputs: Identifiers, gaps and duplicates | Use consistent synthetic identifiers, deliberate missing values and duplicate records. | Keep matching and validation real; selected cases do not establish production prevalence or complete identity coverage. |
| Inputs: Free-text content | Use authored examples with relevant ambiguity and length. | Keep parsing real; a small example set does not measure broad language coverage. |
| Inputs: Dates and time zones | Use fixed boundary dates and explicit zones. | Keep conversion logic real; a fixed clock does not test real scheduling delay. |
| Responses: Tool success | Return a controlled success payload. | Exercise downstream handling; the actual tool operation remains untested. |
| Responses: Tool rejection | Return a documented error shape. | Exercise the recovery branch; real permission enforcement is a separate check. |
| Responses: Delayed answer | Introduce a controlled delay or timeout. | Exercise waiting behavior; this is not a service latency measurement. |
| Responses: Malformed content | Supply missing fields or invalid types. | Exercise validation; distinguish your fixture from a captured service response. |
| Destinations: Local files | Use a disposable directory with the real writer. | Reopen the output; remote storage and audience access remain outside this check. |
| Destinations: Database records | Use controlled records in a test database. | Exercise actual constraints; production configuration is not established. |
| Destinations: Messages | Use a capture destination instead of real recipients. | Inspect payload and routing; public transport delivery is not demonstrated. |
| Destinations: Paid actions | Use a supported test environment or a local substitute. | Inspect the request path; settlement and live commercial effects are excluded. |
| Outcomes: Browser success state | Keep the real interface and assert its visible result. | A success view does not independently prove a remote write. |
| Outcomes: Persisted artifact | Read the output through a separate inspection step. | Check content and identity; existence alone is insufficient. |
| Outcomes: Report and answer check | Specify expected values or properties independently, then compare observed state with the agent’s report. | The checker must be able to reject a plausible explanation; disclose judgment gaps instead of treating the explanation as the answer key. |
02 — Why a mock needs an explicit boundaryWhy a mock needs an explicit boundary
Playwright’s testing guidance recommends user-visible checks, isolated tests and controlled data. It also recommends mocking third-party dependencies. These are useful ways to test the application you own. They do not turn a substituted dependency into evidence of a live integration.
03 — Separate a report test from a delivery testSeparate a report test from a delivery test
In Playwright’s API examples (read September 9, 2026), route.fulfill returns a chosen response without contacting the intercepted API. The contrasting example calls route.fetch, changes the returned data and then fulfills the request with the patched response. The first tests how the page handles a replacement; the second also exercises the API request, while the displayed data is still modified.
Label that difference in the result: “page behavior checked against a replacement response” or “API response obtained and patched before display.” Neither proves an unmodified live workflow. Keep an independent destination check for any write or delivery claim.
The delivery-state reference helps describe the resulting boundary. The file-output acceptance reference supplies the checks for the actual copy. A passing local test should not silently acquire a claim about recipient access.
04 — Preserve the difficult properties of the inputPreserve the difficult properties of the input
Synthetic data becomes misleading when it removes the difficulty the tool must handle. A parser expected to accept names with accents should not be tested only with short plain-English names. A calculation that handles missing values needs deliberate missing cases, not a spreadsheet where every cell is populated.
Preserve relationships as well as individual values. If two records are meant to refer to the same entity, give them a consistent synthetic identifier. If a duplicate is intentional, label why it is present. Otherwise a test can pass because the fixture accidentally avoids the business rule under examination.
Our own-traffic evaluation guide addresses whether tasks represent intended use. This reference addresses what gets replaced within those tasks. Representative examples still need clear substitution boundaries; realistic-looking records alone do not make an integration real.
05 — Keep a substitution note beside the resultKeep a substitution note beside the result
For each test, write: claim, fixture, substituted boundaries, implementation exercised, observed result and remaining check. Include the test version so someone can tell whether a later run used the same setup. This note is more useful than a single “all tests passed” message when the reader must decide whether work is ready.
Do not invent a universal minimum number of examples. Choose cases from the behavior you promise and the failures you need to distinguish. A controlled expiry response can examine recovery logic; an authorized expired credential in a test environment examines whether the real boundary produces the expected denial. Neither alone estimates how often expiry happens.
Keep expected outcomes separate from the agent’s own assertions. For a transformation, use an independently specified expected value or a property the output must satisfy. For a write, inspect the destination through a separate read path where practical. The test should have a way to reject a plausible explanation of a result that never occurred.
- Scope
- Controlled inputs, responses, destinations and independent outcome checks.
- As-of date
- September 7, 2026. Actual source collection and review date; assigned publication is September 7, 2026.
- Collection
- Read Playwright guidance on mocked requests and test isolation. Select cases involving inputs, responses, destinations and outcome checks. For each, specify the exercised behavior and the claim that remains outside the test.
- Sources and interpretation
- Playwright documents replacing requests, patching fetched responses and test isolation. The broader agent test-design map is editorial analysis; no live integration or model run was measured.
- Exclusions
- No vendor census, model benchmark, search-volume estimate, measured savings or failure rate. Worked examples are hypothetical; no customer operations were tested.
- Gaps and limitations
- UNVERIFIED means the required evidence was not inspected, was inaccessible or remains ambiguous after inspection. A selected case can overlap others in practice; preserve the specific claim and its uncertainty.
06 — DecisionWhat to do next
Make every pass say what was exercised.
Keep the relevant behavior real, replace what makes the test unsafe or unstable, and name each substitution. Inspect the resulting state before making a claim that crosses a simulated boundary.
For implementation support, explore our AI transformation services.