Skip to content
intermediate Phase 2 · Test Planning & Strategy

Estimation and Coverage Metrics

Estimate effort and track requirement coverage, defect detection, and escape rates.

55m
0 problems
Topic Progress 0%

Estimating Test Effort Without Guessing: Three Points and a Baseline

The plan asks for your estimate on testing the saved-card feature. The two bad answers are a single number produced instantly ('three days') and a number produced defensively ('hard to say, maybe a week?'). Both fail the same way: they hide the uncertainty instead of modeling it. Two techniques handle estimation honestly, and interviewers ask for both by name.

Three-point estimation forces three numbers per activity instead of one:

optimistic (O)  = 1.5 days   # everything works: build stable, data ready, no blocked deps
most likely (M) = 3.0 days   # normal friction: some retests, one environment hiccup
pessimistic (P) = 6.0 days   # realistic bad day: rework, blocked env, requirement change

PERT mean      = (O + 4M + P) / 6 = (1.5 + 12 + 6) / 6 ≈ 3.25 days
PERT stddev   = (P - O) / 6 = 0.75 days

The formula matters less than the conversation it forces. Producing O requires asking 'what does a perfect run look like?' — which surfaces blockers early (does the test environment exist?). Producing P requires asking 'what typically goes wrong here?' — which surfaces the retest loop and environment flakiness that single-point estimates systematically forget. Reporting the result as '3.25 days ± 0.75' communicates uncertainty honestly; the ± is the part stakeholders remember when planning the sprint.

Summing PERT means across the plan's rows gives the total (the 4.7-day figure from Building a Test Plan came from exactly this arithmetic). But PERT assumes you can decompose the work — and for a whole release, you often cannot. That is where historical velocity acts as the sanity check: the team's last six sprints recorded how many QA-days of planned work were actually consumed. If velocity says this squad reliably completes 4.0 QA-days per sprint and your decomposition totals 4.7, one of the two numbers is wrong — either the plan is optimistic about scope, or the velocity is unrepresentative. Experienced estimators present both numbers and the discrepancy: 'decomposition says 4.7, our history says 4.0 — I recommend trimming E2E scope or the number will trim itself.'

Use-case point estimation is the third method worth naming: score each use case by driver complexity (transaction count, interface count, algorithmic complexity), sum the weighted drivers to a use-case point total, and multiply by a productivity factor calibrated from past projects. It fits portfolio-level estimation (twelve features across a quarter) better than sprint-level work, where three-point decomposition is faster and more precise.

A closing discipline: track estimate vs actual for every cycle, not to grade anyone but to calibrate. Reviewing last quarter's estimates against actuals usually reveals one systematic bias — the tester who always estimates low because they forget environment flakiness, or the team that estimates high to build in slack. Two cycles of feedback corrections beat any formula, which is why the technique matters less than the habit of closing the loop.

For interviews, practice narrating an estimate live: given a feature brief, decompose it into test activities, assign O/M/P with reasons, sum the means, and compare the total against an assumed sprint capacity. Examiners listen for three things — that you include the retest loop in P, that you state the ± range instead of a single number, and that you name what you would cut if the total exceeded capacity. Candidates who can do that arithmetic out loud, on a whiteboard, without hedging, have demonstrated the estimation habit itself, which transfers to any methodology the company uses.

Requirement Coverage vs Code Coverage: What Each Proves

'What is your coverage?' is an ambiguous question until you name the denominator — and the two answers mean completely different things. Requirement coverage asks: what fraction of specified behavior has a verified test? Code coverage asks: what fraction of implementation lines/branches did execution touch? Teams get into trouble when a number from one column is used to imply the other.

Requirement coverage comes from the traceability link (requirement or acceptance criterion → executed, passing test):

requirement coverage = requirements with ≥1 passing executed test / total in-scope requirements × 100

For release 4.12: 24 in-scope requirements, 23 covered → 95.8% — and the uncovered one (REQ-104, admin force-expiry) is named, not averaged away. This is the number that belongs in exit criteria because it answers the business question: what did we promise that nobody checked? Its weakness is granularity: 'covered' hides whether one shallow happy-path case or nine scenarios verify the requirement, so the metric pairs best with the risk bands — a high-risk requirement's single test should not count as comfortably covered.

Code coverage comes from instrumentation during test execution — line, branch, function, and condition coverage, reported by tools like JaCoCo, Istanbul, or coverage.py:

branch coverage = branches taken / branches available × 100    (82% on the payment module)

What it proves: which code the suite executed. What it does not prove: that the suite verified anything. A test that calls a function and asserts nothing moves coverage as much as a thorough one. The famous illustration: printing every element of a list hits ~100% line coverage of the printing logic while testing none of its edge behavior (empty list, huge list, nulls). Coverage of 80% with no uncovered hot spots is a healthy suite; coverage of 95% with the missing 5% being the error-handling paths is a trap metric.

The practical policy experienced teams adopt: use code coverage as a gap-detector, not a target. Set a floor per module (say 70% lines) to force conversations about untested areas, then read the uncovered diff — the new or changed lines the suite never touched — which is far more actionable than the aggregate. Percentage targets without diff-reading get gamed: teams add assertions-free tests to push the number up, which is metric-gaming at its purest.

Both coverage views close through the same door: risk-weighted interpretation. A release reporting 100% requirement coverage and 78% branch coverage can be excellent (the uncovered branches are dead error paths) or alarming (the uncovered branches are the retry logic in the payment service). The number opens the conversation; the risk band of the uncovered area decides what it means. That is why coverage belongs in the same report as the risk matrix, never in a slide alone.

For interviews, the question 'requirement coverage vs code coverage?' is a favorite discriminator. Answer with the two definitions, one formula each, the caveat that code coverage does not prove verification, and the policy (floor plus uncovered-diff reading, no naked percentage targets). Candidates who only know code coverage from CI badges typically stop at the definition — the policy sentence is what distinguishes you.

Defect Detection Percentage, Escape Rate, and the Metrics That Get You Fired

Coverage says what you tested. The quality metrics say how well the testing worked — and two of them run the length of your career because they measure the thing everyone cares about: did defects get found before users did?

Defect escape rate (leakage) tracks where defects were found:

escape rate = defects found in production / (defects found in production + defects found pre-release) × 100

release 4.11: 3 production defects, 57 pre-release → 3/60 = 5.0%
release 4.10: 6 production defects, 44 pre-release → 6/50 = 12.0%

The trend line (12.0% → 5.0%) is the story stakeholders want: detection moved upstream. But the raw percentage invites two distortions, so pair it with context. Severity mix: three escaped typos and three escaped double-charge bugs produce the same rate and completely different meanings — always report escape rate by severity band. And denominator drift: a quiet release with six total defects can show a wild percentage on tiny numbers; annotate the count alongside the rate.

Defect detection percentage (DDP) is the same data viewed from the quality of the pre-release phase: DDP = pre-release defects / all defects × 100 (release 4.11: 95%). It has a useful sibling analysis: detection rate by phase — what percentage of each release's total defects were caught at requirements, unit, integration, system, UAT, or production. If 80% of defects consistently surface at system testing, that says your upstream levels are thin; shifting the curve left is the measurable form of 'shift-left'.

Defect density adds size normalization:

defect density = defects found per KLOC (or per story point, or per requirement)

KLOC density suits maintenance codebases with stable counting; per-requirement or per-story-point density suits agile teams where size counting is already estimated. Its use is comparative: this release at 4.2 defects/story-point against the 3.5 baseline flags something changed — new team member, new service, rushed requirement — before quality does.

Now the traps, because every published metric becomes a target, and bad targets get hit:

Vanity metric How it gets gamed Better signal
Test case count Pad with trivial cases Coverage of requirements weighted by risk
Zero open defects Reject or downgrade reports Defects by severity with age + disposition
Pass percentage Execute only easy cases Executed vs planned with failure dispositions
Code coverage % Assertion-free tests Uncovered changed lines (diff coverage)
Defects closed/week Close-as-duplicate inflation Escape rate + re-open rate

The interview-ready move is to refuse the vanity metric politely and offer its replacement with a one-line reason: 'raw defect counts reward finding trivial bugs; I would report severity-weighted counts plus escape rate, which measures what actually reached users.' That answer demonstrates metric maturity — the rarest QA skill — because it shows you understand both the measurement and the incentive system it creates. The dashboard you build from these metrics is what turns status reporting from spreadsheet archaeology into a live conversation, which is the final topic of this phase.

Quiz

1. For a test activity with optimistic 1.5 days, most likely 3.0, and pessimistic 6.0, what is the PERT estimate?

Question 1 options

2. A release has 24 in-scope requirements; 23 have at least one executed passing test and one has none. What does reporting 95.8% requirement coverage prove and not prove?

Question 2 options

3. A suite reports 95% line coverage but the uncovered 5% is entirely the retry and error-handling paths of the payment service. How should this be interpreted?

Question 3 options

4. Last release: 3 defects found in production, 57 pre-release. What is the escape rate and the correct way to present it?

Question 4 options

Flashcards

Question

How does three-point (PERT) estimation work, and what is it really buying you?

Answer

Estimate each activity optimistic (O), most likely (M), pessimistic (P); mean = (O + 4M + P) / 6, σ = (P − O) / 6. The formula buys less than the conversation: producing O surfaces blockers (missing env, unstable build), producing P forces acknowledgment of the retest loop and flakiness — the things single-point estimates forget. Report as 'mean ± σ'.

Question

Requirement coverage vs code coverage — definitions, formulas, and what each fails to prove.

Answer

Requirement coverage = requirements with ≥1 passing executed test / in-scope requirements; fails to show depth (one shallow test counts the same as nine). Code coverage = branches/lines executed / available (JaCoCo, Istanbul); fails to prove verification — assertion-free tests move it. Use requirement coverage in exit criteria; use code coverage as a gap-detector on the uncovered diff, not a target.

Question

Define defect escape rate and defect detection percentage, and name the two distortions to control for.

Answer

Escape rate = production defects / (production + pre-release defects) × 100; DDP is its mirror (pre-release / all). Distortions: (1) severity mix — trivial and critical escapes inflate the rate equally, so report by severity band; (2) denominator drift — tiny releases produce wild percentages, so always show the raw counts beside the rate.

Question

Why is 'zero open defects' a dangerous target, and what replaces it?

Answer

It incentivizes rejecting or downgrading reports and closing without fixing — the metric gets hit instead of quality improving. Replace it with defect counts by severity plus age and disposition (fixed / signed deferral / invalid), which shows the true state and keeps deferrals visible and owned.

Question

What is defect density, and which denominator suits agile teams?

Answer

Defect density normalizes defect counts by size: defects per KLOC (maintenance codebases with stable counting), per story point, or per requirement (agile teams that already estimate size). Its value is comparative — a release at 4.2 defects/story-point against a 3.5 baseline flags a change (new member, new service, rushed requirements) before users feel it.

Revision Notes

Key Takeaways

  • 1. Estimation honesty comes from three-point ranges plus historical velocity — a single number hides the blockers and retest loops that actually consume cycle time
  • 2. Requirement coverage belongs in exit criteria; code coverage is a gap-detector read on the uncovered diff, never a percentage target
  • 3. Escape rate and DDP measure whether detection moved upstream — report escape rate by severity band with raw counts and trend, or the number misleads
  • 4. Every published metric becomes a target and bad targets get gameable behavior; prefer ratio and trend signals over counts and binary goals
  • 5. The mature QA move is refusing the vanity metric politely and offering its replacement with a one-line reason

Interview Tips

  • • "Estimate testing for this feature." — walk three-point out loud (O/M/P with reasons), give 'mean ± σ', then compare the sum with team velocity and state the recommended scope adjustment when they diverge
  • • "Requirement coverage or code coverage — which do you report?" — both, with jobs: requirement coverage in exit criteria (business view), code coverage as a gap-detector on the uncovered diff (engineering view); add the caveat that coverage never proves verification
  • • "Escape rate was 5% last release — good?" — answer 'better than 12% before, but show me the severity mix and counts'; that follow-up demonstrates you know rate metrics mislead without denominators and severity context
  • • "Leadership wants a zero-open-defects target." — refuse with the incentive argument (reports get rejected, fixes get closed), then offer the replacement: severity counts with age and disposition, plus escape rate as the outcome metric

Cheat Sheet

Estimation and Coverage Metrics

Three-point (PERT): mean = (O + 4M + P) / 6; σ = (P − O) / 6. Report 'mean ± σ'. O surfaces blockers, P surfaces the retest loop. Sanity-check totals against historical velocity (last 6 sprints' actual QA-days); present the discrepancy.

Requirement coverage: ≥1 passing executed test per requirement / in-scope × 100. Use in exit criteria; depth-blind → read with risk bands.

Code coverage: executed branches/lines. Gap-detector, not target: set a floor, then read the uncovered DIFF (new/changed lines). Never chase the aggregate — assertion-free tests game it.

Defect metrics:

Metric Formula Pair with
Escape rate prod / (prod + pre-release) severity band + trend
DDP pre-release / all phase detection-rate curve
Density defects / KLOC or / story point release-over-release comparison

Vanity-metric traps: test count → risk-weighted coverage · zero-bug target → severity+age+disposition · pass % → executed-vs-planned with dispositions · coverage % → diff coverage · closures/week → escape + re-open rate.

Continue Learning

Related Reading