TDD (EN)
TermTest-driven development where tests are written first
Definition
Test-Driven Development (TDD) is an approach where first an automated test for a non-existing function is written. This test is initially executed and must fail since the function is not yet implemented. Then the minimal code is implemented that allows the test to pass successfully. This is followed by a refactoring step to improve the code without changing its functionality.
TDD Cycle
flowchart TD A[Red: Write test] --> B[Green: Write minimal code] B --> C[Yellow: Refactor code] C --> A
In Context
- Typically used together with XP (Extreme Programming) and CI/CD
- Related to: BDD (Behavior-Driven Development), ATDD (Acceptance Test-Driven Development)
- Example use case: Development of microservices with clearly defined contracts