Test Driven Development (TDD)
Test Driven Development is a development technique where tests are written before the actual code.
Classification
- ComplexityMedium
- Impact areaTechnical
- Decision typeArchitectural
- Organizational maturityAdvanced
Technical context
Principles & goals
Use cases & scenarios
Compromises
- Insufficient test coverage
- Misunderstandings of requirements
- Loss of focus on the goal
- Conduct regular code reviews.
- Continuous testing throughout the development process.
- Maintain documentation of test cases.
I/O & resources
- Development Requirements
- Testing Tools
- Developer Knowledge
- Functional Software
- Documented Tests
- Deployable Code
Description
Test Driven Development (TDD) is an iterative process where tests for a functionality are written before the implementation occurs. This approach promotes quality and maintainability of the code and helps to identify bugs early.
✔Benefits
- Increased Software Quality
- Early Bug Detection
- Improved Code Maintainability
✖Limitations
- Higher initial effort
- Possible project delays
- Experience required with TDD
Trade-offs
Metrics
- Error Rate
Measure of the number of bugs found in the software.
- Test Coverage
Percentage of code covered by tests.
- Development Costs
Total cost of software development including tests.
Examples & implementations
Online store with TDD
An online store uses TDD to develop new features while ensuring a high standard of quality.
Mobile App Development
A team develops a mobile app and uses TDD to optimize user experience.
Web Development Project
In a web development project, TDD is used to ensure that new lines of code do not introduce existing errors.
Implementation steps
Define steps for introducing TDD.
Train the team in TDD techniques.
Implement initial TDD projects.
⚠️ Technical debt & bottlenecks
Technical debt
- Insufficient test coverage.
- Obsolete test cases.
- Lack of documentation of tests.
Known bottlenecks
Misuse examples
- Not versioning test data.
- Not updating tests regularly.
- Too many dependencies in tests.
Typical traps
- Not adapting one-off tests.
- Low team acceptance.
- Focus on test coverage over code quality.
Required skills
Architectural drivers
Constraints
- • Resource Availability
- • Team Size
- • Budget Constraints