官术网_书友最值得收藏!

Red, green, refactor

We’ve covered a lot of ground, and we have gone into excruciating detail for a very simple test. All of the ground work is now done for us to speed up.

Let's look at the red, green, refactor cycle:

The steps of the TDD cycle are as follows:

  1. Write a failing test: Write a short test that describes some functionality you want. Execute your test and watch it fail. If it doesn’t fail, then it's not a good test; go back and try again.
  2. Make it pass: Make the test green. Do the simplest thing that will work. Feel free to make a mess; you can clean it up later.
  3. Refactor your code: Stop, slow down, and resist the urge to move on to the next feature. Work hard to make your code—both production and test code—as clean as it can be.
主站蜘蛛池模板: 金川县| 通州市| 鲁甸县| 广平县| 达州市| 泰安市| 霸州市| 剑河县| 凤阳县| 屏东市| 三台县| 商都县| 蒙阴县| 河曲县| 横山县| 胶南市| 米脂县| 香河县| 榆树市| 成武县| 祁阳县| 昌江| 明光市| 丹寨县| 都江堰市| 孟村| 英吉沙县| 南阳市| 泸溪县| 南漳县| 临武县| 贺州市| 平利县| 兴山县| 新绛县| 万盛区| 五大连池市| 沂源县| 阿拉善盟| 华池县| 凤凰县|