Skip to content
Tutorials Center
My learning

Topics

Lesson 28 of 60 ยท Test Planning and Documentation

Risk-Based Testing

Prioritize testing with risk: likelihood times impact, product vs project risk, a risk matrix and a runnable scorer that ranks features by risk.

You can never test everything. The seven testing principles say so plainly, and every real project has less time than it needs. The question is not "how do we test it all?" but "what do we test first, and how deeply?" Risk-based testing answers that: spend most of your effort where a failure would hurt most and is most likely to happen.

This lesson explains what risk means in testing, the two families of risk, how to score and rank features, and how the ranking changes your test plan. The scoring code is a stand-in for the spreadsheet or workshop most teams use; the arithmetic is the same.

What is a risk?

A risk is a possible future problem. In testing we describe it with two numbers:

  • Likelihood: how probable is it that the problem happens (or that the feature is faulty)?
  • Impact: how bad is it if it does (money, safety, reputation, legal trouble, user frustration)?

A common simple model is risk score = likelihood x impact, each rated on a small scale such as 1 to 5. A rarely used report page that is slightly wrong scores low. A payment calculation that is often changed and affects money scores high.

Two numbers, one score

Likelihood How probable is a fault?
Impact How costly is the failure?
Score Likelihood times impact.

Rate each on a small scale, such as 1 to 5.

1 / 3

Product risk and project risk

Testers deal with two different families of risk, and it helps not to mix them up.

Product risks are about the software itself: wrong calculations, data loss, slow pages, security holes, confusing screens. Testing reduces product risk by finding problems before users do. Product risk drives what you test.

Project risks are about running the project: the build arrives late, the test environment is unstable, a key tester is ill, requirements keep changing, the schedule is too tight. Testing does not reduce these directly; you manage them with planning, communication and fallback plans. Project risk drives how and when you test. See Test Strategy and Test Plan for where both belong in the plan.

Product risk Project risk
About The software The project
Example Discounts calculated wrongly Test environment unavailable for a week
Handled by Choosing and running tests Contingency, scheduling, communication

The risk matrix

If you plot likelihood against impact you get a risk matrix, a grid where the top-right corner is the danger zone.

TEXT
Impact
  5 |  5   10   15   20   25
  4 |  4    8   12   16   20
  3 |  3    6    9   12   15
  2 |  2    4    6    8   10
  1 |  1    2    3    4    5
    +------------------------
       1    2    3    4    5   Likelihood

Teams usually group the scores into bands, for example 1 to 5 low, 6 to 12 medium and 15 to 25 high. The exact bands matter less than agreeing on them in advance so that arguments are about the facts, not the labels.

From risk to test effort

A risk ranking should change your plan in concrete ways:

  • Depth: high-risk features get more test cases, more techniques (for example both equivalence partitioning and boundary analysis), and more experienced testers.
  • Order: test the riskiest areas first, so that serious bugs surface while there is still time to fix them.
  • Types of test: a payment feature gets security and accuracy checks; a report page gets a quick sanity pass.
  • Regression: high-risk areas stay in the regression pack permanently.
  • Stop rule: if time runs out, the untested part is the lowest risk, which you can explain to stakeholders.

Risk is also not a one-time exercise. Re-score when requirements change, when a defect shows a feature is shakier than thought, and when production incidents teach you something. Involve developers, product owners and support staff: each sees different risks, and the scores should be a shared judgment, not one tester's guess. Link the resulting priorities to your traceability matrix so no high-risk requirement is left without tests.

Try it: rank features by risk score

Each feature gets a likelihood and an impact from 1 to 5. The script computes the score, assigns a band, sorts by risk and suggests a testing depth. Change a number and run again to see the ranking move.

JS Risk scoring and ranking

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

No output.

Try it: what the ranking does to a schedule

Suppose you have only 7 days of testing but the full plan needs more. A risk-based plan spends the days from the top of the list downward instead of spreading them evenly. This second stand-in does exactly that with invented effort values.

JS Spend limited days by risk

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

No output.

The output is a conversation tool. You can now tell the product owner, "Product search, the order history page and the footer links are untested; their risk is lower, and here is why." That is far better than a vague "we ran out of time". If a few days were left over, a real plan would spend them on the next item at reduced depth.

FMEA and risk priority numbers

The risk matrix above multiplies two ideas, likelihood and impact. FMEA (failure mode and effects analysis) is a more detailed method that comes from engineering (aerospace, automotive, medical devices) and is used in software where failures are costly. It adds a third question: how likely are we to notice the problem before it hurts someone?

For each feature or component, a team lists:

  • Failure mode: how it could fail ("payment is charged twice").
  • Effect: what the user or business experiences ("customer loses money, support call").
  • Cause: why it could happen ("retry after a timeout").
  • Current controls: what already prevents or detects it (a unit test, monitoring).

Then each failure mode gets three scores, usually 1 to 10:

Score Question 1 means 10 means
Severity (S) How bad is the effect? Barely noticeable Safety, legal or total loss
Occurrence (O) How likely is the cause? Almost never Almost certain
Detection (D) How likely are we to miss it before release? Surely caught Almost impossible to detect

Multiply them to get the risk priority number:

RPN = Severity x Occurrence x Detection (range 1 to 1000)

A high RPN marks a failure mode that is serious, likely and hard to catch, so it deserves early, deeper testing or a design change. After you add tests or controls, the team re-scores Occurrence and Detection and checks that the RPN fell.

Notes for careful use: the scales must be defined and agreed in writing, RPN values are comparable only within one analysis, and a very high severity (for example a safety effect) is handled first even when the RPN is low, because multiplying can hide a catastrophic effect behind a low occurrence.

JS Rank failure modes by RPN

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

No output.

The list is not a replacement for judgement: "Stock count goes negative" sits second because it is hard to detect (D = 8), the point of the third factor, which a plain likelihood-times-impact matrix would ignore.

Limits and pitfalls

  • Scores are judgments, not measurements. A 4 versus a 5 is an opinion; the value is in the discussion that produces it.
  • Do not ignore the "low" band entirely. Low-risk areas still deserve a basic check, and low scores can be wrong.
  • Multiplying hides differences. A 5 x 1 and a 1 x 5 both score 5, but a rare catastrophic failure is not the same as a frequent trivial one. Some teams treat any impact of 5 (safety, legal) as automatically high.
  • Risk changes. Revisit the ranking when something new is learned.
  • Do not confuse risk with severity. Severity describes a found defect (bug reports cover it); risk describes possible problems before you test.

Check your understanding

Quick check ยท 4 questions

of 4 answered You scored / 4 ยท perfect!

  1. 1. In the simple model, how is a risk score calculated?

    Multiplying likelihood and impact (for example 1 to 5 each) gives a score from 1 to 25 that can be sorted and grouped into bands.
  2. 2. The test environment will be unavailable for a week. What kind of risk is this?

    It threatens how the project runs, not the behavior of the software. It is handled with planning and contingency, not by writing more tests.
  3. 3. Why test the highest-risk features first?

    Early execution of high-risk areas leaves time to fix and retest. If time runs out, the untested part is the least dangerous.
  4. 4. Why can a pure likelihood-times-impact score mislead?

    Multiplication can hide very high impact. Teams often add a rule that safety, legal or financial extremes are treated as high regardless of the product.

Summary

  • Risk is likelihood combined with impact; a simple score is likelihood times impact on a small scale.
  • Product risks concern the software and drive what to test; project risks concern the project and are managed through planning.
  • A risk matrix groups scores into low, medium and high bands that the team agrees on beforehand.
  • Use the ranking to decide depth, order, test types and what to leave untested when time runs short.
  • Scores are shared judgments; revisit them as you learn.

Next: Test Execution and Result Tracking.