#0040 · 方法
先写一个会失败的测试
修 bug 或加功能前,先写一个能复现问题的测试,跑一遍确认它是红的;再改代码让它变绿;最后跑一遍全部测试。一开始就是绿的测试,什么也没测。
Before fixing a bug or adding a feature, write a test that reproduces it and watch it fail. Then change the code until it passes, and run the whole suite. A test that was green from the start tests nothing.
小杜
已贴 1,040 张上墙共收到 0 个章