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

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.
主站蜘蛛池模板: 西藏| 普兰县| 云霄县| 平顶山市| 时尚| 台湾省| 唐山市| 通州区| 洱源县| 南雄市| 正宁县| 涡阳县| 建平县| 漾濞| 淳安县| 开原市| 健康| 岢岚县| 五莲县| 江油市| 新源县| 同仁县| 民乐县| 吉林市| 哈尔滨市| 安龙县| 昭平县| 商河县| 青川县| 高州市| 新巴尔虎左旗| 枞阳县| 赣榆县| 广汉市| 松原市| 普兰县| 阿尔山市| 武强县| 南雄市| 渭南市| 山东|