TDD Evidence — 证明改动有效
TDD Evidence 是 Matt Pocock 对 agent 时代 TDD 的重新定义:核心不是"测试先行"的顺序,而是证据——你的测试必须证明改动做到了它声称做的事("tests that prove that your change does what it says it does")。
What it is
Matt 在播客中重新审视 TDD:
- 他自己在 2016-2019 年是 TDD 布道者("you must do TDD"),现在观点改变
- 传统 TDD 的价值是"知道何时完成",但对 agent 而言这个价值消失:agent 通过 conversation 知道何时完成,且不会"过度开发"某功能
- 真正的本质:证据——验证执行没有破坏现状,并向 reviewer/未来开发者证明改动有效
- 对 AI 的真正担忧不是"测试不足",而是 agent 生成大量代码 + 大量测试但"they just don't fit together"
Matt: So what you're actually looking for is evidence... tests that prove that your change does what it says it does.
Why it matters
把 TDD 争论从"顺序之争"(先写测试还是先写代码)转向"证据之争"(测试是否证明了改动意图),更贴合 agent 的实际行为模式,也回应了 harness-engineering/ai-augmented-vs-dependent 中"agent 写大量测试但无人读"的组织风险。
Key points
- TDD 的顺序价值对 agent 消失:agent 通过对话知道完成时点
- 证据价值保留:向 reviewer 和未来开发者证明改动有效
- 真正风险是错配:大量代码 + 大量测试但它们不咬合
- Matt 的历史转向:从 TDD 布道者到重新定义,标志行业经验在 agent 语境下的再校准
- 机制解释(第二来源):Pragmatic Engineer 访谈中 Matt 给出原理——TDD 优化的是人类的小工作记忆,agent 的工作记忆更大、不需要这个;但 agent 需要反馈环加防作弊证据:"TDD evidence: 证明没有这个改动测试会失败"
- tautological tests 风险(第二来源):agent 常写断言实现本身的测试,形式上覆盖、实际上无证据价值,review 时需专门抽查
Counterpoints & Gaps
- "agent 不会过度开发"是 Matt 的观察,无系统性验证
- 证据标准(什么算 prove)仍需项目内定义
How to apply
- 把 review 标准从"有没有测试"改为"测试是否证明了改动声称的事"
- 对 agent 生成的测试做咬合抽查:测试与实现是否互相印证
Related
- harness-engineering/ai-driven-e2e-testing — AI 驱动 E2E 测试
- harness-engineering/ai-augmented-vs-dependent — 增强型 vs 依赖型
- harness-engineering/agent-trust-verification — Agent 信任验证
2026-11-06 — A concrete red-green hook workflow
@dani_avila7 describes a TDD Hook workflow: write a behavior test before changing production code, run it and confirm the expected failure, make the minimum change that passes, then run the full suite. The post recommends using the sequence even for a one-line fix when the behavior can be tested, and reviewing the skill source and hook behavior before installation.
This is a concrete way to produce evidence, but the post alone does not show the hook implementation or prove that it prevents tests from merely restating the implementation. Review the hook and inspect the test's failure reason before relying on it.
Sources (2026-11-06 addendum)
Pending Jean review
- Inspect the linked skill and hook before adopting; verify that the test fails for the intended behavior and that the hook's scope is understood.