Mempraktikkan TDD secara efektif melampaui sekadar mengenal siklus Red-Green-Refactor — ini melibatkan mengambil langkah kecil, menulis tes yang tepat, melakukan langkah refactor dengan baik, dan menerapkan pertimbangan tentang kapan TDD cocok. Jika dilakukan dengan baik, ini mendorong desain yang baik dan kode berkualitas tinggi yang teruji dengan baik.
Siklus yang disiplin
1. RED — write ONE small failing test for the NEXT bit of behavior (run it, see it fail —
confirms the test works and the feature is missing)
2. GREEN — write the SIMPLEST code to pass (don't over-engineer; even "fake it" first)
3. REFACTOR — now improve the design (remove duplication, clean up) with tests as a safety net
→ SMALL steps; one behavior at a time; stay in short cycles.
