How to Measure Software Quality Metrics
You can't improve what you don't measure. Yet most companies track revenue and velocity while treating quality as an unmeasurable gut feeling. A handful of well-chosen metrics can tell you whether your quality trajectory points toward excellence or crisis.
Defect Escape Rate
Bug escape rate measures bugs reaching production versus total bugs found.
Formula: (Bugs found in production / Total bugs found) × 100
If you found 100 bugs total with 15 reaching production: escape rate = 15%.
Industry targets vary by domain. Consumer apps might tolerate 20-30%. Financial software should target single digits. Track trends -are you catching more bugs before release over time?
Code Coverage
Coverage measures what percentage of code executes during automated tests. Most tools report line coverage, branch coverage, and function coverage.
Target 60-80% for most applications. 100% is counterproductive -you'll waste effort testing trivial code. Use coverage as a floor (below 60% needs attention) rather than a goal.
Track trends: coverage should stay stable or increase. Sudden drops indicate new code without tests.
Mean Time to Resolution (MTTR)
MTTR measures average time from bug discovery to deployed fix.
Formula: (Sum of time to resolve all bugs) / (Number of bugs resolved)
Segment by severity. Critical bugs might target hours; low-priority bugs might accept days.
Improving MTTR requires better debugging tools, comprehensive logging, efficient code review, and streamlined deployment.
Test Pass Rate
How often does your automated test suite pass on first run? Target 95%+.
Below 90% is a quality emergency. Flaky tests train developers to ignore failures, defeating automation's purpose. Quarantine, fix, or delete flaky tests -don't tolerate them.
Defect Density
Bugs per thousand lines of code (or per module) identifies quality hotspots.
If one module has 3x higher defect density than others, it needs refactoring or additional testing. Declining density over time indicates improving practices.
Cycle Time for Quality Activities
How long do code reviews take? How long to run test suites? Long cycle times create pressure to skip quality activities.
If reviews take 3+ days, developers batch changes into larger PRs. If test suites take 30+ minutes, people skip them locally. Fast feedback enables high quality.
Putting Metrics to Work
Start with escape rate and MTTR. Add coverage if investing in automation. Review monthly with engineering teams, looking for trends.
Use metrics to drive improvement, not punish individuals. When metrics reveal problems, invest in better tools and processes -not blame.
Ready to implement quality metrics? Learn how BetterQA helps teams establish data-driven quality practices.