- 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.
推薦閱讀
- C語(yǔ)言程序設(shè)計(jì)教程
- Java程序員面試算法寶典
- Access 2010數(shù)據(jù)庫(kù)基礎(chǔ)與應(yīng)用項(xiàng)目式教程(第3版)
- MATLAB實(shí)用教程
- JavaScript by Example
- SAP BusinessObjects Dashboards 4.1 Cookbook
- Hands-On Natural Language Processing with Python
- Gradle for Android
- Windows Phone 7.5:Building Location-aware Applications
- Learning Concurrency in Kotlin
- Machine Learning in Java
- JavaScript+jQuery網(wǎng)頁(yè)特效設(shè)計(jì)任務(wù)驅(qū)動(dòng)教程
- SEO教程:搜索引擎優(yōu)化入門與進(jìn)階(第3版)
- Python Machine Learning Cookbook
- C語(yǔ)言程序設(shè)計(jì)與應(yīng)用實(shí)驗(yàn)指導(dǎo)書(第2版)