Product and in-process quality metrics
Clear definitions, formulas and exam-style worked examples for common product and in-process quality metrics used to measure software quality and testing progress.
Drafted with Aria, reviewed by the AiCanCode.org team · Updated . How we write and check our notes. Spotted an error? Use Give Feedback at the bottom of the page.
Why it matters
Engineers use product and in-process quality metrics to measure the quality of the software product itself (bugs, reliability) and to monitor the test and development process (test progress, defect flow). These metrics help decide release readiness, focus testing, track improvements, and find process bottlenecks.
Key ideas
Defect: any flaw, fault or failure in software that causes it to deviate from requirements.
Defect density: number of defects per thousand lines of code (KLOC) or per function point; it gives a size-normalised view of defects in the product. Exact definition: Defect density = total counted defects ÷ product size (in KLOC or FP). State your size unit when you compute it.
Defect Removal Efficiency (DRE): fraction of total defects found before release. Exact definition: DRE = defects found and fixed before release ÷ total defects (pre-release + post-release). Assumes we can count post-release defects discovered in a comparable period.
Defect leakage (escape rate): fraction of total defects that escaped pre-release and were found post-release; leakage = D_post ÷ (D_pre + D_post) = 1 − DRE.
Mean Time To Failure (MTTF): average operational time until a failure for non-repairable systems or between failures for repairable systems when used as uptime. Define whether repairable or not before using formula.
Mean Time To Repair (MTTR): average time to restore operation after a failure — a measure of maintainability.
Mean Time Between Failures (MTBF): average time between the start of one failure and the start of the next; for repairable systems it equals MTTF + MTTR under the usual assumptions.
Availability (A): fraction of time the system is operational; for repairable systems in steady state A = MTTF / (MTTF + MTTR) = MTTF / MTBF.
Failure rate (λ): expected failures per time unit; for constant-rate (exponential) models, use λ ≈ 1/MTTF for non-repairable items and λ ≈ 1/MTBF for repairable systems.
In-process metrics measure activities during development and testing:
- Test execution progress: fraction of planned test cases executed; used to track testing throughput.
- Pass rate (or test pass percentage): fraction of executed tests that passed.
- Code coverage (e.g., statement, branch, function): percentage of code elements executed by the test suite; complements pass rate but does not guarantee correctness.
- Defect discovery rate: defects found per time unit (day, week); useful for trend analysis and resource allocation.
- Defect backlog: defects reported but not yet resolved; used to track unresolved risk.
- Review effectiveness (or review defect density): defects found in reviews per KLOC or per 1000 lines reviewed.
- Build breakage rate: how often builds fail per build attempts; high rate indicates poor integration hygiene.
Assumptions to state when using metrics: what counts as a defect, start/end times for observation, size unit (LOC/KLOC/function points), whether duplicates are deduplicated, and the observation period for post-release defects.
Diagrams you may be asked to draw:
- Defect trend chart: x-axis = time (days/weeks/sprints), y-axis = cumulative defects found; plot two series: pre-release and post-release. Label axes, series, and mark release point.
- Control chart for defect discovery rate: x-axis = time unit, y-axis = defects found per unit; draw mean and upper/lower control limits; label anomalies.
Formulas
Defect density = D_total / KLOC
D_total = total defects counted; KLOC = thousands of lines of code (LOC/1000). Unit: defects/KLOC. Use when size in LOC is available.
Defect density_FP = D_total / FP
D_total = total defects; FP = function points. Unit: defects per function point. Use when FP measurement available.
DRE = D_pre / (D_pre + D_post)
D_pre = defects found and fixed before release; D_post = defects found after release (in the chosen observation window). Unit: ratio (×100% for percent). Applies when you can count pre- and post-release defects.
Defect leakage (%) = (D_post / (D_pre + D_post)) × 100 = 100% − DRE (%)
Unit: percent. Sometimes called escape rate (from test to field).
Test execution progress (%) = (T_executed / T_planned) × 100
T_executed = number of tests executed; T_planned = total planned tests. Unit: percent. Applies for test-suite progress.
Pass rate (%) = (T_passed / T_executed) × 100
T_passed = executed tests that passed. Unit: percent.
Defect discovery rate = D / Δt
D = defects found in period Δt. Unit: defects per day/week. Use for trend analysis.
MTTF = total uptime / number_of_failures
total uptime in hours; number_of_failures = count. Unit: hours. Use for average time to failure.
MTTR = total downtime / number_of_repairs
total downtime in hours; number_of_repairs = count. Unit: hours. Use for maintainability.
MTBF = MTTF + MTTR
Unit: hours. Applies under the usual repairable-system assumption where MTBF measures time between start of failures.
Availability A = MTTF / (MTTF + MTTR)
Unit: ratio (×100% for percent). Applies for repairable systems in steady state; equals uptime fraction.
Failure rate (non-repairable) λ ≈ 1 / MTTF; (repairable) λ ≈ 1 / MTBF
Unit: failures per hour (or per chosen time unit). Applies for constant-rate (exponential) failure models; state which case you are using.
Worked examples
Example 1 — Defect density and DRE (product metric)
Given: total LOC = 25 000 LOC, defects found and fixed before release = 45, defects reported after release in first month = 5. Assume we measure size in KLOC.
Formula:
Defect density = D_total / KLOC.Compute KLOC = 25 000 / 1000 = 25 KLOC.
Compute D_total = 45 + 5 = 50 defects.
Substitute: Defect density = 50 / 25 = 2 defects/KLOC.
Final: 2 defects/KLOC.Formula:
DRE = D_pre / (D_pre + D_post).Substitute: DRE = 45 / (45 + 5) = 45 / 50 = 0.9 = 90%.
Final: DRE = 90%.
(Assumptions: we counted all duplicates and customer reports in the same way; size measured in LOC.)
Example 2 — Reliability times (product metric)
Given: observed uptime = 2000 hours, total downtime = 10 hours, observed failures = 4. (Assume observation period includes both uptime and downtime reports separately.)
Formula:
MTTF = total uptime / number_of_failures.Substitute: MTTF = 2000 h / 4 = 500 h.
Final: MTTF = 500 hours.Formula:
MTTR = total downtime / number_of_repairs.Substitute: MTTR = 10 h / 4 = 2.5 h.
Final: MTTR = 2.5 hours.Formula:
MTBF = MTTF + MTTR.Substitute: MTBF = 500 h + 2.5 h = 502.5 h.
Final: MTBF = 502.5 hours.Formula:
Failure rate λ ≈ 1 / MTBF(repairable system case).Substitute: λ ≈ 1 / 502.5 h ≈ 0.00199 failures/hour.
Final: λ ≈ 0.00199 failures/hour.
(Assumptions: uptime and downtime were measured consistently; exponential failure model assumed for λ approximation.)
Example 3 — In-process metrics (test progress)
Given: planned tests = 400, executed = 320 in 8 days, of executed tests 240 passed and 80 failed; defects found (unique) = 96.
Formula:
Test execution progress (%) = (T_executed / T_planned) × 100.Substitute: (320 / 400) × 100 = 80%.
Final: Test execution progress = 80%.Tests executed per day = 320 / 8 = 40 tests/day.
Final: 40 tests/day.Formula:
Defect discovery rate = D / Δt.Substitute: 96 defects / 8 days = 12 defects/day.
Final: 12 defects/day.Formula:
Pass rate (%) = (T_passed / T_executed) × 100.Substitute: (240 / 320) × 100 = 75%.
Final: Pass rate = 75%.
(Notes: failed tests may map to more than one defect; state this when interpreting.)
Common mistakes
- Confusing MTBF and MTTF; always state whether system is repairable and whether MTBF includes repair time.
- Mixing time units (hours vs days) without conversion in MTTF/MTTR/λ calculations.
- Treating test-case failures and unique defects as identical counts (one failed test can reveal multiple defects or many tests can expose the same defect).
- Not stating observation period for post-release defects (this changes DRE strongly).
For your exam
Expected question types: definitions (define DRE, defect density, MTTF, MTTR), short notes (advantages and limits of a metric), derivations (derive MTBF = MTTF + MTTR under repairable-system assumptions), numericals (compute defect density, DRE, MTBF, failure rate), diagram tasks (draw defect trend chart and interpret), and interpretation questions (what a rising defect discovery rate means).
What full-marks answers include:
- A clear definition with bold metric name and units.
- Stated assumptions (time window, size unit, counting rules).
- Correct formula and step-by-step substitution with units.
- A short interpretation sentence (what the number means for product/release).
- If asked, a simple diagram labelled correctly (axes, series, release point or control limits).
Quick check
- What is the formula for Defect Removal Efficiency (DRE)?
- If a system has MTTF = 200 h and MTTR = 5 h, what is MTBF?
- You executed 150 of 300 planned tests and 120 passed. What are execution progress and pass rate?
Answers: DRE = D_pre / (D_pre + D_post). MTBF = 200 + 5 = 205 hours. Execution progress = 50%; Pass rate = (120/150)×100 = 80%.
Finished this topic? Mark it so your progress, study plan and readiness keep up.
Stuck on something here?