Retour au glossaire
Testing

TDD (Test-Driven Development)

A software development practice where tests are written before the actual code, following a cycle of: write a failing test, write minimal code to pass, then refactor.

Definition

TDD follows the "Red-Green-Refactor" cycle: Red (write a test that fails), Green (write the minimum code to pass the test), Refactor (improve code while keeping tests green). This approach ensures every feature has test coverage, encourages simpler designs, and provides immediate feedback. TDD was popularized by Kent Beck as part of Extreme Programming (XP).

Pourquoi c'est important

Teams practicing TDD report 40-90% reduction in bug density. TDD creates a comprehensive test suite as a byproduct of development, documents expected behavior, and enables confident refactoring. Studies show TDD code has fewer defects and better design.

Exemple

Before writing a password validator, a developer writes a test: expect(validatePassword("abc")).toBe(false). The test fails. They implement the minimum validation logic to pass, then refactor for clarity.

Termes lies

TDDtest-driven developmentwhat is TDDTDD meaningtest first

Automatisez le Code Review avec diffray

Systeme d'IA multi-agent pour code review. Trouve automatiquement bugs, vulnerabilites de securite et problemes d'architecture.