Skip to content
Tutorials Center
My learning

Topics

Lesson 27 of 60 ยท Test Planning and Documentation

Traceability and Test Estimation

Build a requirements traceability matrix to find coverage gaps, and estimate test effort with expert, ratio and three-point (PERT) methods, with runnable examples.

Two questions come up in almost every test project. The first is "Did we test everything that was asked for?" The second is "How long will testing take?" Both sound simple and both are easy to answer badly. A traceability matrix answers the first with evidence instead of feelings; estimation techniques answer the second with ranges instead of a single hopeful number.

This lesson explains both, then gives you two runnable stand-ins: a script that builds a requirements traceability matrix and flags gaps, and a script that turns three-point guesses into a PERT estimate. Real teams keep the matrix in a test management tool or a spreadsheet and the estimate in a plan, but the logic is exactly what you will see here.

Requirements traceability

Traceability means you can follow a thread in both directions: from a requirement to the tests that check it, and from a test back to the requirement it protects. The table that records those links is the requirements traceability matrix (RTM).

TEXT
Requirement                              Test cases            Status
REQ-01  Users can sign up with email     TC-01, TC-02, TC-03   Covered
REQ-02  Passwords need 8+ characters     TC-04, TC-05          Covered
REQ-03  Users can reset a password       (none)                GAP
REQ-04  Accounts lock after 5 failures   TC-06                 Covered

What a matrix tells you

Coverage gaps Requirements with no test at all.
Impact of change Which tests to rerun when a requirement moves.
Orphan tests Tests that protect no requirement.
Audit evidence Proof of what was checked, and when.

Forward trace and backward trace use the same table.

1 / 2

Coverage here means requirement coverage: the share of requirements with at least one test. That is a different thing from the code coverage in White-Box Testing and Code Coverage. A requirement can be "covered" by one weak test, so the matrix finds gaps, not quality. Pair it with the review advice in Writing Good Test Cases and the risk thinking in Risk-Based Testing.

Practical tips for keeping a matrix useful:

  • Give every requirement a stable ID so links survive rewording.
  • Record the link in the test case itself (a requirement field), then generate the matrix from that data instead of maintaining two copies.
  • Trace to user stories or acceptance criteria in agile teams; the principle is identical.
  • Review gaps with the product owner. Some gaps are intentional (a requirement is out of scope this release); write that down instead of leaving a silent blank.

Try it: build a traceability matrix

The data below is invented. The script builds the forward matrix, then finds uncovered requirements and orphan test cases. Add a new test case that references REQ-03 and run it again to watch the gap close.

JS Requirements traceability matrix

Press Run (or Ctrl + Enter) to see the console output here.

No output.

The orphan TC-07 references a requirement that does not exist. That is a typical real-world finding: either the requirement ID is a typo, or the test checks something nobody asked for and should be justified or removed.

Why estimation is hard

Test effort depends on things you do not know at the start: how buggy the build is, how often it is rebuilt, how long fixes take, and how many cycles of retesting follow. A single number ("five days") hides all that. Good estimates share three habits: they are built from parts, they come as ranges or with stated assumptions, and they are updated as facts arrive.

Common techniques:

Technique How it works Good for
Expert judgment Experienced people estimate, then compare and discuss Quick early estimates
Work breakdown Split testing into tasks (design, data, execution, retest, report) and estimate each Detailed plans
Ratio from history Use past projects: testing took about 35% of development effort Rough budgets when history exists
Planning poker or Delphi Independent estimates are revealed together and discussed Reducing one person's bias
Three-point (PERT) Optimistic, most likely, pessimistic values combined Tasks with real uncertainty

Do not forget the "invisible" work: environment setup, waiting for builds, meetings, and retesting. A simple model is: effort = (test design + execution) x number of cycles, plus fixed overhead. If you expect two cycles, say so openly.

Three-point estimates

For each task you give three numbers: O (optimistic, everything goes well), M (most likely) and P (pessimistic, but still realistic). The PERT formulas weight the most likely value:

  • expected value: E = (O + 4M + P) / 6
  • standard deviation: SD = (P - O) / 6

The standard deviation gives you a feeling for uncertainty. For a sum of independent tasks, add the expected values and combine the standard deviations as the square root of the sum of squares. About two thirds of outcomes fall within one SD of the expected value, and about 95% within two. These are rules of thumb that assume independent tasks and a bell-shaped spread, so treat them as a conversation starter, not a promise.

Try it: a PERT estimate for a test cycle

The tasks below are invented values in person-days.

JS Three-point (PERT) test estimate

Press Run (or Ctrl + Enter) to see the console output here.

No output.

Read the last line the way a project manager would: if you promise the expected total, you will miss it about half the time. Promising the higher figure costs more time on paper but keeps the promise far more often. Share both numbers with the team and let them choose with open eyes.

Wideband Delphi and ad-hoc estimates

Two more estimation approaches are worth knowing. In Wideband Delphi, a small group of experts each estimate the work privately, then the numbers are shown anonymously, the group discusses why they differ (one person may know about a hidden integration), and everyone estimates again. The rounds repeat until the estimates converge. It reduces the influence of the loudest voice and surfaces assumptions. Ad-hoc estimation is a quick guess from experience, such as "this is about two days like the last one". It is fast and sometimes right for small tasks, but it cannot be defended or audited, so use it only for low-stakes items and record your assumptions.

Keeping estimates honest

  • State assumptions: "two cycles, builds arrive on time, test environment ready by Monday."
  • Re-estimate when assumptions change, such as a late build or a new feature.
  • Track actuals against estimates; after two or three projects your ratios become far better than anyone's gut feeling.
  • Do not pad silently. Extra margin hidden inside every task is hard to defend; an explicit contingency line is easier to discuss.
  • Link the estimate to the risks. High-risk areas deserve more time and earlier runs, as described in Risk-Based Testing.

Check your understanding

Quick check ยท 4 questions

of 4 answered You scored / 4 ยท perfect!

  1. 1. A requirements traceability matrix mainly helps you to...

    The matrix links requirements and tests in both directions. It finds gaps and shows impact, but says nothing about the quality of each test.
  2. 2. A test case points at a requirement ID that does not exist. What is it called?

    Backward tracing finds tests with no valid requirement. Either the ID is wrong or the test checks something nobody asked for.
  3. 3. With O = 2, M = 4 and P = 12, what is the PERT expected value?

    E = (2 + 4 x 4 + 12) / 6 = 30 / 6 = 5. The most likely value is weighted four times, pulling the result slightly toward the long pessimistic tail.
  4. 4. Why give an estimate as a range or with assumptions?

    Uncertainty is real. A range and visible assumptions make the estimate honest and allow it to be updated when facts change.

Summary

  • A traceability matrix links requirements to test cases in both directions; it reveals coverage gaps, orphan tests and the impact of change.
  • Requirement coverage shows gaps, not test quality, and is different from code coverage.
  • Estimate from parts, as ranges, with stated assumptions, and include retesting and overhead.
  • Three-point (PERT) estimation uses E = (O + 4M + P) / 6 and SD = (P - O) / 6.
  • Track actual effort so future estimates improve.

Next: Risk-Based Testing.