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
