QA Metrics
Defect Density
The number of defects found per unit of software size (e.g., per 1000 lines of code or per module).
Full definition
Defect density measures the concentration of defects in a software component. It's calculated as: Defect Density = Number of Defects / Size of Component.
Common measurements:
- Defects per 1000 lines of code (KLOC)
- Defects per module
- Defects per feature/user story
- Defects per sprint
Why it matters:
- Identifies problem areas that need more attention
- Tracks quality trends over time
- Helps allocate testing resources effectively
- Industry benchmarks: 1-25 defects per KLOC is typical
The Pareto principle applies: 80% of defects are often found in 20% of modules. Defect density helps you find those problem modules and focus testing there.
Combine with other metrics: defect density alone doesn't tell the full story. A module with high defect density might just be well-tested, while a module with zero defects might be untested.