- Mastering React Test:Driven Development
- Daniel Irvine
- 153字
- 2021-06-24 14:45:04
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:
- 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.
- 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.
- 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.
推薦閱讀
- Embedded Linux Projects Using Yocto Project Cookbook
- Java多線程編程實戰指南:設計模式篇(第2版)
- Java EE框架整合開發入門到實戰:Spring+Spring MVC+MyBatis(微課版)
- 零基礎學Scratch少兒編程:小學課本中的Scratch創意編程
- PyTorch Artificial Intelligence Fundamentals
- DevOps入門與實踐
- Easy Web Development with WaveMaker
- concrete5 Cookbook
- D3.js 4.x Data Visualization(Third Edition)
- Nginx Lua開發實戰
- 深入淺出Go語言編程
- Cocos2d-x Game Development Blueprints
- SQL Server 2008 R2數據庫技術及應用(第3版)
- Swift語言實戰晉級
- Backbone.js Testing