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

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.
主站蜘蛛池模板: 闸北区| 南溪县| 迭部县| 惠安县| 连江县| 凤城市| 新河县| 元谋县| 潮安县| 浦江县| 通州区| 云龙县| 南丰县| 大姚县| 乌兰浩特市| 上高县| 苏尼特左旗| 忻城县| 襄汾县| 渝中区| 拜城县| 泰安市| 大方县| 洮南市| 偃师市| 富平县| 洛南县| 沁水县| 呼玛县| 焦作市| 新化县| 三门峡市| 赣榆县| 白山市| 光泽县| 鄂尔多斯市| 黄冈市| 民权县| 浑源县| 陵水| 深水埗区|