Test monitoring, control and metrics
Notes on test monitoring, control and metrics: definitions, formulas, examples and exam guidance for measuring and managing test progress and product quality.
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
Test monitoring, control and metrics help engineers decide whether a software project is on track and what corrective actions to take. Monitoring gives a factual view of test progress and quality; control means making decisions (for example, stop testing, add resources) based on those measurements.
Key ideas
Monitoring — the ongoing collection, measurement, analysis and reporting of test progress and product quality against the plan and exit criteria; it provides the factual basis used by control.
Metric — a metric is a quantitative measure of some property of the software, process or product (for example, number of defects, execution time). A metric must be defined with: what is measured, how it is measured, the unit, and the collection frequency.
Key performance indicator (KPI) — a KPI is a metric chosen because it matters to the project goals (for example, defect escape rate, test pass rate). KPIs must have target values and thresholds.
Defect density — number of defects per unit size (commonly per thousand lines of code, KLOC) used to compare modules of different sizes. Requires a clear rule for counting defects and measuring size.
Defect Removal Efficiency (DRE) — the fraction of defects found before release compared to all defects found before and after release. Precisely: if E = defects removed before release and L = defects reported after release, DRE = E/(E+L). DRE is an empirical measure of how effective defect-detection activities were.
Failure rate (λ) — failures per unit time during operation. For non-repairable items, λ(t) is the hazard (failure) rate; for repairable systems, use failure intensity (instantaneous) or an average over a stated period.
Mean Time To Repair (MTTR) — average time required to repair after a failure. Mean Time Between Failures (MTBF) — average elapsed time between failures (can include repair time, depending on definition used by the organisation). Common formula relationships are shown below; state which definition you use in the exam. Also clarify MTTF (Mean Time To Failure): for non-repairable items it is the expected lifetime to first failure; under the convention where MTBF includes repair time for repairable systems, MTBF = MTTF + MTTR.
Control charts and statistical control — use time-series charts with control limits to detect unusual variation. For many metrics the control limits are the mean plus or minus three standard deviations (UCL = μ + 3σ, LCL = μ − 3σ) assuming roughly normal variation or large-sample approximations. Choose chart types to match the data: I-MR or X-bar/R for continuous measurements; c/u-charts for defect counts; p/np-charts for proportions; use the corresponding formulas for their control limits.
Assumptions commonly required by these definitions: measurements are collected consistently; defects are counted according to a single rule; time measurements use the same clock; the process is stationary while calculating historical mean and σ for control limits. Always state assumptions in an exam.
Diagram to draw (if asked): draw a feedback loop titled "Test monitoring and control". Box 1: "Collect metrics" (label examples: tests run, passed, defect count, DRE). Arrow to Box 2: "Analyze / trend" (show control chart, KPI vs target). Arrow to Box 3: "Decision / control actions" (examples: stop testing, increase resources, change exit criteria). Arrow back to Box 1 labeled "Implement changes and continue monitoring". Also show thresholds on the control chart: UCL and LCL lines and a point outside UCL.
Formulas
Defect density = D / S — D = number of defects found (unit: defect), S = size in KLOC (unit: KLOC). Applies when size is measured in thousands of lines of code.
DRE = E / (E + L) — E = defects removed before release (defect), L = defects found after release (defect). Dimensionless (often expressed as %). Applies when E and L are counted for the same release scope. Defect escape rate = L / (E + L) = 1 − DRE — dimensionless; complements DRE and is sometimes used as a KPI.
Test pass rate = P / R — P = number of test cases passed (count), R = number of test cases run (count). Dimensionless (express as %).
Failure rate λ = F / T — F = number of failures in period (count), T = observation time (second, hour). Unit: failures per second or failures per hour. Applies to measured period.
MTTR = total downtime / number of failures — total downtime in seconds or hours, failure count is dimensionless. Unit: seconds or hours. Applies when downtime and failures are recorded.
MTBF = total elapsed time / number of failures — total elapsed time in seconds or hours, fails count dimensionless. Unit: seconds or hours. Applies for repairable systems when total time includes uptime and downtime.
UCL = μ + 3·σ — μ = sample mean of the metric (same unit as metric), σ = sample standard deviation. LCL = μ − 3·σ. Applies when using 3-sigma control limits for approximate statistical control.
Defect arrival rate (per day) = total defects reported / number of days — unit: defects/day.
Note: Always state which counts (for example, whether defects include duplicates) you used when applying formulas.
Worked examples
Example 1 — DRE (numerical, show steps):
Given: Defects removed before release E = 240 (defects). Defects found after release L = 60 (defects).
Formula: DRE = E / (E + L).
Step 1: E + L = 240 + 60 = 300 (defects).
Step 2: DRE = 240 / 300 = 0.8.
Answer: DRE = 80% (this means 80% of defects were found before release).
Example 2 — Defect density (numerical):
Given: Module size S = 1 500 lines of code = 1.5 KLOC. Defects found D = 45.
Formula: Defect density = D / S.
Step 1: S = 1.5 KLOC.
Step 2: Defect density = 45 / 1.5 = 30 defects/KLOC.
Answer: Defect density = 30 defects/KLOC.
Example 3 — MTTR and MTBF (numerical):
Given: Over one month (total elapsed time T = 720 hours) there were 5 failures. Total downtime across all failures = 10 hours.
Formula: MTTR = total downtime / number of failures and MTBF = total elapsed time / number of failures.
Step 1: MTTR = 10 hours / 5 = 2 hours.
Step 2: MTBF = 720 hours / 5 = 144 hours.
Answer: MTTR = 2 hours, MTBF = 144 hours.
Worked example (control chart decision): Given daily defect counts for 10 days: [3, 2, 4, 3, 5, 12, 3, 4, 2, 3]. Compute mean μ and sample standard deviation σ, draw UCL/LCL and decide if day 6 is out of control. Step 1: μ = (3+2+4+3+5+12+3+4+2+3)/10 = 41/10 = 4.1. Step 2: compute σ (show in exam: square deviations, sum, divide by n−1, sqrt). Result σ ≈ 2.91 (student to compute). UCL = 4.1 + 3·2.91 ≈ 12.83, LCL = 4.1 − 3·2.91 ≈ −4.63 (set to 0 for counts). Day 6 count = 12 (< UCL), so not formally out of control by 3-sigma rule, but close: discuss trend and investigate. (This shows you must interpret charts, not only apply rules.) Note: Using a c-chart with Poisson limits (UCL ≈ 4.1 + 3·sqrt(4.1) ≈ 10.17) would flag day 6 as out of control; choose the chart type to match the data.
Common mistakes
- Using MTBF = MTTF without stating definitions; confuse MTTR and MTBF.
- Applying control-chart formulas without verifying stationary data or using small-sample corrections.
- Reporting DRE without clarifying the time window (which releases or support period are included).
- Treating test pass rate as a complete quality indicator — it measures test execution, not defect severity or coverage.
For your exam
Kinds of questions you will get: definitions (define monitoring, control, metric, KPI, DRE), short notes (explain control charts, list important test metrics), derivations (derive DRE formula and explain assumptions), numericals (compute DRE, defect density, MTTR/MTBF, control limits), diagrams (draw the monitoring-control feedback loop and a control chart), and analysis (interpret trends and propose control actions).
What a full-marks answer includes:
- Precise definitions with bold terms and units where applicable.
- Stated assumptions (how defects counted, period, size unit).
- Correct formula and step-by-step calculation with units and numeric checks.
- For diagrams: labelled boxes and arrows, thresholds and a clearly marked point outside control limits if used.
- Short discussion of what control action you would take and why (for control questions).
Quick check
- Define DRE in one sentence.
- Formula for defect density using KLOC.
- If MTTR = 3 hours and there are 10 failures in a 300-hour period, what is MTBF? Answers: DRE = fraction of defects removed before release, DRE = E/(E+L). Defect density = D/S (defects per KLOC). MTBF = 300/10 = 30 hours.
Finished this topic? Mark it so your progress, study plan and readiness keep up.
Stuck on something here?