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

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.
主站蜘蛛池模板: 伊吾县| 龙井市| 全州县| 连江县| 商洛市| 潜山县| 綦江县| 石家庄市| 禹州市| 县级市| 龙游县| 荥经县| 南江县| 广元市| 沅江市| 鲁甸县| 江西省| 凤台县| 四子王旗| 朝阳县| 宁安市| 利川市| 潮安县| 汪清县| 新龙县| 崇明县| 伊通| 南溪县| 上饶市| 苏尼特左旗| 南皮县| 石台县| 河北区| 改则县| 云霄县| 宁陕县| 丹东市| 岳池县| 克什克腾旗| 韶关市| 朝阳区|