Test-Driven Development (TDD) shine aiki inda ka rubuta gwaje (tests) kafin code — bin gajeren, maimaita zanga: rubuta gwaje da bai aiwu ba, rubuta code don ya wuce shi, sannan sake gyara (refactor). Yana tukarki yadda aka yi zane ta hanyar gwaje kuma yana tabbatar da cewa code ana iya gwaji kuma an gwaji shi sosai.
Zanga 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
