A test supplies conditions, observes a result, and compares it with an expected result. It gives evidence about the behavior it actually exercises. Passing a test is not proof that all inputs, configurations, or users are safe.
Different scopes answer different questions
Consider a hypothetical booking service that rejects a departure date earlier than the arrival date:
- A unit test can check the date comparison in isolation with valid, equal, and reversed dates. It is usually quick and makes a failure easy to locate.
- An integration test can check that the booking endpoint uses that comparison and rejects a reversed date when its connected components work together. Depending on the test, a real or controlled substitute for a database may be used.
- An end-to-end test can exercise the user-facing booking path across the relevant parts of a system. It may reveal wiring problems that a unit test misses, but can be slower and harder to diagnose.
These categories overlap in practice; name the boundary and dependencies rather than relying on a label. A unit test passing does not show that the endpoint calls the function. An integration test passing with a substitute database does not establish the behavior of the production database.
Turn failures into feedback
A regression is a return of unwanted behavior. When fixing a reproducible defect, a focused regression test can express the intended outcome. Where practical, run it against the faulty version and confirm it fails for the expected reason, then apply the fix and run it again. A test that fails because its setup is broken does not demonstrate the bug. Re-run broader relevant checks after the focused one; a local fix can affect other behavior.
Change → check → observe failure or pass → interpret → next change
Inspect the assertion: does it check the promised behavior, or merely reproduce the implementation’s current answer? An agent can generate a test and implementation that share the same mistaken assumption. Cover representative normal cases, boundaries, and important failures; prefer useful tests over a large count. Keep durable tests for important behavior, and weigh the maintenance cost of fragile implementation-specific tests. A temporary diagnostic check can be removed when appropriate, but do not discard an important regression safeguard just because requirements might someday change.
Ask for exact checks, outcomes, and skipped checks. “All tests passed” without a scope or run record tells us little. A skipped or blocked test is not a pass.