---
title: "Software testing metrics"
subject: "Software Engineering"
chapter: 8
key: "semester_5/software_engineering:testing-metrics"
source: https://www.bctengineer.com/q/semester_5/software_engineering/testing-metrics
site: BCT Engineering
---

# Software testing metrics

Software Engineering · Chapter 8: Software Testing and cost Estimation

- Asked in: year not given, 4 marks
- Video: [Software Testing Metrics: Types and Examples](https://www.youtube.com/watch?v=8Io6IRiwYio) — QA Madness
- Answer checked by Claude Opus 5.5 (high effort) on 2026-10-14
- Page: https://www.bctengineer.com/q/semester_5/software_engineering/testing-metrics
- Whole chapter: https://www.bctengineer.com/md/semester_5/software_engineering/chapter-8

## Question

Explain software testing metrics.

## Short answer

Software testing metrics are quantitative measures for testing progress, quality, and effectiveness. Key metrics include test execution percentage, pass rate, defect density (defects/KLOC), defect removal efficiency (DRE = E/(E+D)), defect leakage, and code coverage. They guide release readiness and process improvement, not individual blame.

## Answer

**Software testing metrics** are quantitative measures used to estimate the progress, quality and effectiveness of testing. They help managers decide whether the software is ready to release and how to improve the test process.

**Base metrics** are raw counts collected during testing: number of test cases written, executed, passed, failed and blocked, number of defects found, and effort spent. **Derived metrics** are calculated from them.

| Metric | Formula / meaning |
|---|---|
| Test execution % | Tests executed / total tests × 100 |
| Pass rate % | Tests passed / tests executed × 100 |
| Defect density | Defects found / size (KLOC or function points) |
| Defect removal efficiency (DRE) | E / (E + D), E = errors found before delivery, D = defects found after delivery |
| Defect leakage % | Defects found by users / total defects × 100 |
| Requirements coverage | Requirements tested / total requirements × 100 |
| Code coverage | Statements or branches executed / total × 100 |
| Defects by severity | Count of critical, major, minor defects |
| Mean time to failure (MTTF) | Average operating time between failures |
| Test effort | Person-hours per test case or per defect |

**Example:** 95 errors are found during testing and 5 defects are reported by users after release. DRE = 95 / (95 + 5) = 0.95, so testing removed 95% of the defects. If the system is 20 KLOC, defect density = 100 / 20 = 5 defects per KLOC.

Metrics should be used to improve the process, not to blame individual testers.

## Check yourself

The answer's key points as multiple-choice questions, with the correct option and why.

1. What are software testing metrics used for?
   A. To rank individual testers for blame
   B. To measure the progress, quality and effectiveness of testing and decide release readiness
   C. To replace test cases
   D. To count lines of code only
   Answer: B. They are quantitative measures that help managers judge readiness and improve the test process, not blame people. (Key point: Purpose of testing metrics)

2. With E errors found before delivery and D defects found after, what is DRE?
   A. D / (E + D)
   B. E / D
   C. E / (E + D)
   D. (E + D) / E
   Answer: C. DRE = E / (E + D); with 95 and 5 it is 0.95, i.e. 95% of defects removed by testing. (Key point: Defect removal efficiency)

3. 100 defects are found in a 20 KLOC system. What is the defect density?
   A. 5 defects per KLOC
   B. 20 defects per KLOC
   C. 0.2 defects per KLOC
   D. 2000 defects per KLOC
   Answer: A. Defect density = defects / size = 100 / 20 = 5 per KLOC. (Key point: Defect density)

## Related in Software Engineering

- [Top-down integration problems; regression testing](https://www.bctengineer.com/question.md?key=semester_5%2Fsoftware_engineering%3Atop-down-integration-regression) — Software Engineering, chapter 8
- [Failure after acceptance testing; integration testing](https://www.bctengineer.com/question.md?key=semester_5%2Fsoftware_engineering%3Afail-after-acceptance) — Software Engineering, chapter 8
- [User acceptance testing](https://www.bctengineer.com/question.md?key=semester_5%2Fsoftware_engineering%3Auser-acceptance-testing) — Software Engineering, chapter 8
- [Regression testing](https://www.bctengineer.com/question.md?key=semester_5%2Fsoftware_engineering%3Aregression-testing) — Software Engineering, chapter 8
- [Black-box testing](https://www.bctengineer.com/question.md?key=semester_5%2Fsoftware_engineering%3Ablack-box-testing) — Software Engineering, chapter 8
- [Functional versus structural testing; COCOMO for 200 KLOC](https://www.bctengineer.com/question.md?key=semester_5%2Fsoftware_engineering%3Afunctional-vs-structural-cocomo2) — Software Engineering, chapter 8

## Related in other subjects

- [Software bugs and testing techniques](https://www.bctengineer.com/question.md?key=semester_5%2Finstrumentation_ii%3Abug-types-testing) — Instrumentation II, chapter 9, asked 2×
- [Software testing time paradox](https://www.bctengineer.com/question.md?key=semester_5%2Finstrumentation_ii%3Asw-testing-paradox) — Instrumentation II, chapter 9
- [Software maintenance and fixing common bugs](https://www.bctengineer.com/question.md?key=semester_5%2Finstrumentation_ii%3Asw-maintenance-bugs) — Instrumentation II, chapter 9
