Test-Driven Development (TDD) ఒక ఆచరణ, ఇక్కడ మీరు కోడ్కు ముందు టెస్టులను రాయండి — ఒక చిన్న, పునరావృత్తమయ్యే చక్రం: విఫలమైన టెస్టను రాయండి, దానిని ఆమోదించడానికి కోడ్ రాయండి, ఆపై రీఫ్యాక్టర్ చేయండి. ఇది టెస్టుల ద్వారా డిజైన్ను నడిపిస్తుంది మరియు కోడ్ పరీక్ష సాధ్యమైనది మరియు బాగా పరీక్షించబడినది అని నిশ్చితం చేస్తుంది.
TDD చక్రం: Red, Green, Refactor
1. RED → write a FAILING test for the behavior you want (it fails — the code doesn't exist yet)
2. GREEN → write the MINIMUM code to make the test PASS (just enough, don't over-build)
3. REFACTOR → improve/clean up the code (and tests) while keeping tests GREEN
→ Repeat this short cycle for each small piece of behavior.
Write test (RED) → write code (GREEN) → clean up (REFACTOR) → repeat
