Trust means believing a test’s result reflects whether the functionality it covers works. A trustworthy test fails when that functionality breaks and passes when it works. Trust sits alongside readability and maintainability: a test that is hard to understand is also hard to check when its result looks wrong. section 7.0
Your reaction to a result is a useful check. If a failure seems safe to ignore, you suspect a false positive. If a pass still sends you to manual testing, you suspect a false negative. With a trusted test, a failure prompts investigation and a pass reduces that extra checking. section 7.1
When a test fails, ask what actually caused it:
- Did it uncover a production bug? That is the failure a test is meant to report. section 7.2
- Is the test buggy, out of date, in conflict with another test, or flaky? Each makes its current result less dependable. section 7.2
Check that a test can catch a bug
Suppose a JavaScript password validator should add an error when a rule rejects an input. Temporarily disable the line that adds that error. A test covering rejected input should now fail; restore the line and it should pass. This gives you evidence that the test can detect this particular breakage, especially when the test was written after the code. section 2.5.2 section 1.11
A green result is not enough on its own. A test with no assertions, expected values calculated using the same logic as production code, or several exit points checked together can conceal problems. Keep expectations simple and make each checked result clear. When verifying mock interactions, separate requirements so an early failed assertion does not prevent later checks from running; do not assert against a stub merely to prove it was queried. section 7.6 section 4.4
Trust also depends on what a test covers. Fast unit tests alone cannot establish that the whole application works together. End-to-end tests give broader confidence but are slower, harder to maintain, and more prone to flakiness; adding many similar ones brings diminishing returns. Use a few for important paths and test further variations at lower levels where practical. Isolate flaky tests for investigation, then fix, replace, or remove them rather than treating unpredictable failures as normal. section 10.5 section 7.6













