正在打开每日关注
正在打开每日关注
Richard Wu 主张智能体时代测试优先级应为 E2E、集成、黄金测试,单元测试大多沦为冗余。
IMO the only tests you should have in the age of coding agents are, in order of priority: 1. Full E2E tests. Nothing mocked out at all. Can even be something that runs in prod on test accounts via Playwright or equivalent. 2. Integration tests. Agents make more mistakes as things bleed between data/API boundaries where schemas can drift. 3. Golden tests. This helps ground the code with real examples of data, and can be used as regressions against edge cases. Unit tests are bloat 99% of the time if you’re using a frontier model since they’re smart enough now to get the implementation (and subsequent iterations) right on the first shot, so they only add bloat at this point.
是什么 这是 Richard Wu(@0xrwu)的一条纯观点推文,没有外链与图片。核心主张:在使用编码智能体的时代,测试应按优先级重排——① 完全零 mock 的全链路 E2E 测试(可经 Playwright 在生产测试账号上运行);② 集成测试,因为智能体最容易在数据/API 边界处因 schema 漂移犯错;③ 基于真实数据样本的黄金测试,用于锚定实现并防范边缘用例回归。而单元测试在 99% 的情况下是冗余的。
核心论点链条 其推理建立在前沿模型能力跃迁之上:模型已足够聪明,能在首轮就写对实现及后续迭代,因此传统上用于约束实现细节的单元测试失去了验证价值;真正的风险转移到系统边界(schema 漂移)与端到端行为,所以验证重心应上移到集成与 E2E 层。
关键洞察 这实质上是对经典测试金字塔的颠覆——从「大量单元测试打底」转向「少量高层测试托底」。测试的角色从「规范实现」变为「守护行为」,这一转变只有在 AI 能可靠写出正确实现的前提下才成立,代表了 AI 原生研发流程的一种激进但逻辑自洽的工程取向。
边界与风险 该观点依赖「首轮即正确」的假设,对非前沿模型、遗留代码或高确定性领域(支付、安全)未必成立;零 mock 的 E2E 也有运行成本高、反馈慢、定位难的问题,实践中仍需权衡。