Platform

Solutions

Resources

Platform

Solutions

Resources

Platform

Solutions

Resources

Blog

— min read

Top Test Coverage Techniques for Testers

Rishabh Kumar

Published on

Summarise this article with AI:

ChatGPT

Perplexity

Claude

Grok

Google AI

Summarise this article with AI:

ChatGPT

Perplexity

Claude

Grok

Google AI

Summarise this article with AI:

ChatGPT

Perplexity

Claude

Grok

Google AI

Preferred source on Google

See our articles first on Google

See more of our content in Google Search

See more of our content in Google Search

Add to Favorites ↗

Table of contents

Test coverage techniques measure how much of your software your tests actually check. Code-based techniques count the statements, branches and paths your tests run. Behaviour-based techniques count the requirements, user journeys, inputs and environments your tests prove. You need both, because 100% code coverage can still miss the feature a customer relies on.

Many escaped defects trace back to something nobody tested: a requirement with no test, a branch that never ran, a browser nobody tried. Coverage techniques are how you find those gaps before your users do.



Why Test Coverage Defines Software Quality

Test coverage is a measure of how much of a defined scope your tests exercise, usually expressed as a percentage:

Coverage = (items tested ÷ total items) × 100

The interesting part is what counts as an "item". For statement coverage, it's a line of code. For requirements coverage, it's a requirement. For browser coverage, it's a browser and OS combination. Each technique defines items differently, and each reveals a different kind of gap.

One warning before the techniques: high coverage isn't the same as good testing. A test that runs code without checking the result counts towards coverage, and proves nothing. Coverage tells you where you haven't looked. It doesn't tell you how well you looked.

Five Kinds of test Coverage



Which Technique Answers Which Question?

Technique

Question It Answers

Typical Owner

Function coverage

Was every function called?

Developers

Statement coverage

Was every line run?

Developers

Branch coverage

Did every decision go both ways?

Developers

Condition coverage

Was every part of each decision tested true and false?

Developers

MC/DC

Does each condition independently affect the outcome?

Developers in safety-critical work

Path coverage

Was every route through the code tried?

Developers, for critical logic

Boundary and equivalence coverage

Were the edges and classes of each input tested?

QA

State transition coverage

Was every state change tested?

QA

Combinatorial coverage

Were the key combinations of options tested?

QA

Requirements coverage

Does every requirement have a passing test?

QA and business analysts

User journey coverage

Do whole user tasks work end to end?

QA

API coverage

Is every endpoint, method and response tested?

Developers and QA

Environment coverage

Does it work on every browser and OS users have?

QA

Test data coverage

Were the important kinds of data tried?

QA

Risk-based coverage

Are the riskiest areas tested most?

QA leads

Mutation coverage

Would our tests actually catch a bug?

Developers and QA



16 Test Coverage Techniques, With Examples

The 16 techniques fall into five families: code-based, input and behaviour, business, environment and data, and advanced. Most teams use several from each, choosing the depth by risk.

Code-Based Coverage Techniques


  1. Function Coverage

Was every function or method called at least once? It's the coarsest measure, useful as a first check that no part of a module was left completely untouched.


  1. Statement Coverage

The share of executable lines your tests run. If a module has 1,000 statements and your tests run 800, statement coverage is 80%.

For delivery_charge, one test with a £60 basket, a member and express delivery runs every line except charge += 5.00. Add a non-member express order, and every statement has run.

  • Good for: finding code that never runs at all, including dead code.

  • Watch out for: it says nothing about the decisions in between. Every line can run while half the logic goes untested.

  • Common starting point: many teams aim for around 80% on business-critical code, and higher on safety-critical systems.


  1. Branch Coverage

Every decision, whether it's an if, a switch or a ternary, has outcomes. Branch coverage checks that tests take every outcome, not just one.

Here's a simpler example of why that matters:

def apply_discount(price: float, code: str) -> float:
    if code == "SAVE10":
        price = price * 0.9
    return price

# 100% statement coverage, but only 50% branch coverage
def test_save10_takes_10_percent_off():
    assert apply_discount(100.0, "SAVE10") == 90.0

# Add this to reach 100% branch coverage: the "false" side of the decision
def test_unknown_code_leaves_price_unchanged():
    assert apply_discount(100.0, "NOPE") == 100.0
def apply_discount(price: float, code: str) -> float:
    if code == "SAVE10":
        price = price * 0.9
    return price

# 100% statement coverage, but only 50% branch coverage
def test_save10_takes_10_percent_off():
    assert apply_discount(100.0, "SAVE10") == 90.0

# Add this to reach 100% branch coverage: the "false" side of the decision
def test_unknown_code_leaves_price_unchanged():
    assert apply_discount(100.0, "NOPE") == 100.0
def apply_discount(price: float, code: str) -> float:
    if code == "SAVE10":
        price = price * 0.9
    return price

# 100% statement coverage, but only 50% branch coverage
def test_save10_takes_10_percent_off():
    assert apply_discount(100.0, "SAVE10") == 90.0

# Add this to reach 100% branch coverage: the "false" side of the decision
def test_unknown_code_leaves_price_unchanged():
    assert apply_discount(100.0, "NOPE") == 100.0
def apply_discount(price: float, code: str) -> float:
    if code == "SAVE10":
        price = price * 0.9
    return price

# 100% statement coverage, but only 50% branch coverage
def test_save10_takes_10_percent_off():
    assert apply_discount(100.0, "SAVE10") == 90.0

# Add this to reach 100% branch coverage: the "false" side of the decision
def test_unknown_code_leaves_price_unchanged():
    assert apply_discount(100.0, "NOPE") == 100.0

The first test runs every line, so statement coverage says 100%. But it never checks what happens when the code doesn't match, and that hidden "else" path is exactly where bugs like discounts applied to the wrong code tend to live.

  • Good for: business rules, validation and permissions, anywhere decisions matter.

  • Common starting point: around 75% or more for code with significant decision logic.

A high statement figure sitting on top of a low branch figure is one of the most common blind spots in coverage reports, and the difference is unpacked in our comparison of statement coverage vs branch coverage.


  1. Condition Coverage

Branch coverage checks each decision's overall result. Condition coverage checks each individual condition inside it. For if is_member and express, branch coverage only needs the whole thing to be true once and false once. Condition coverage also needs is_member to be both true and false, and express to be both true and false.

This exposes bugs where one condition hides another, which matters most in security checks, access control and validation rules.


  1. Modified Condition/Decision Coverage (MC/DC)

MC/DC goes one step further: it proves each condition can change the outcome on its own. For is_member and express, three tests are enough:

  • Member, express: true and true, so the decision is true.

  • Non-member, express: false and true, so the decision is false. Only is_member changed, and the outcome flipped.

  • Member, standard delivery: true and false, so the decision is false. Only express changed, and the outcome flipped.

MC/DC is required for the most critical software in aviation under DO-178C, and is used in other safety-critical fields like automotive and medical devices, because it gives strong assurance without testing every possible combination.


  1. Path Coverage

Branch coverage tests each decision. Path coverage tests every route through all the decisions together. delivery_charge has two decisions in sequence, the second with three outcomes, giving six possible paths. A function with three simple if statements in a row has eight (2 × 2 × 2).

  • Good for: financial calculations, pricing, compliance logic and safety-critical algorithms.

  • Watch out for: paths multiply fast, and loops can create an endless number. In practice, teams test basis paths (a minimum set that covers every decision) or limit loops to zero, one and many iterations.


Input and Behaviour Coverage Techniques


  1. Boundary and Equivalence Coverage

Instead of counting code, count the kinds of input you've tested. Equivalence partitioning splits inputs into groups that should behave the same way, and boundary value analysis tests the edges of each group.

For free delivery on baskets of £50 or more, the partitions are "under £50" and "£50 or more". The boundaries are £49.99 and £50.00. Full coverage means at least one test in each group, and a test on each side of every edge.

Most input bugs sit exactly at the edges, which is why boundary value analysis earns its place alongside every code coverage report.


  1. State Transition Coverage

Many features move between states: an order goes from "Placed" to "Paid" to "Shipped" to "Delivered", or to "Cancelled" or "Refunded". State transition coverage checks that every allowed transition works, and that disallowed ones are blocked, like refunding an order that was never paid.

  • State coverage: every state is reached at least once.

  • Transition coverage: every allowed move between states is tested.

  • Invalid transition coverage: every move that shouldn't be possible is tried and rejected.


  1. Combinatorial (Pairwise) Coverage

When a feature has several options, testing every combination quickly becomes impossible. Four settings with five values each make 625 combinations. Pairwise testing covers every pair of values at least once, often in around 25 to 30 tests, because most defects are triggered by one setting or an interaction between two.

Choosing which combinations still matter when you can't test them all is the art behind pairwise testing.

Business Coverage Techniques


  1. Requirements Coverage

Requirements coverage maps every documented requirement to the tests that prove it. Unlike code metrics, it checks business intent: are we testing what stakeholders actually asked for?

  • Link each requirement to one or more test cases.

  • Track which requirements have passing tests.

  • List requirements with no test at all.

  • Watch the trend across releases.

A team can have high code coverage and low requirements coverage at the same time, if its tests check how the code is built rather than what it's meant to do.

Keeping that mapping honest as requirements change between releases is the job of a requirements traceability matrix.


  1. User Journey Coverage

Unit tests check parts. Integration tests check connections. Journey coverage checks that whole tasks work the way users actually do them. For an online checkout, that means one test that adds items to the basket, applies a discount code, enters delivery details, pays and sees the confirmation.

Each step might be well covered on its own. Journey coverage proves they work together, which is where many customer-facing bugs hide.


  1. API Coverage

  • Endpoint coverage: which endpoints have tests.

  • Method coverage: GET, POST, PUT, PATCH and DELETE on each.

  • Parameter coverage: required, optional and edge-case values.

  • Response coverage: success codes and every documented error, like 400, 401, 403, 404 and 429.

A ready-made checklist for each of those dimensions is collected in our list of API testing test cases.

Environment and Data Coverage Techniques


  1. Environment Coverage

The share of browsers, operating systems and screen sizes your users have that your tests run on. Base the list on your analytics, not guesswork. If many of your customers use Safari on iPhone, a suite that only runs in desktop Chrome has a large blind spot, however high its code coverage.


  1. Test Data Coverage

Have your tests tried the important kinds of data? Think new and returning customers, UK, EU and US addresses, names with accents and apostrophes, empty and very long lists, and amounts in £, € and $. Many production bugs come from data the test suite never saw.

Advanced Coverage Techniques


  1. Risk-Based Coverage

Rather than chasing the same percentage everywhere, put the most coverage where failure would hurt most. Factors to weigh:

  • Business impact: revenue, customer-facing journeys, regulatory reporting.

  • Complexity: heavily branched logic and many dependencies.

  • Change frequency: modules that change every sprint.

  • Defect history: areas that have failed before.

  • Integration points: third-party services and other systems.

Turning those factors into a ranked list of what to rerun after each change is set out step by step in risk-based regression testing.


  1. Mutation Coverage

Mutation testing checks whether your tests would actually catch a bug. A tool makes small changes to your code, called mutants, like turning >= into >, and reruns your tests. If a test fails, the mutant is "killed". If every test still passes, your tests didn't notice the bug.

# Original rule: free delivery from £50
if basket_total >= 50:
    charge = 0.0

# Mutant: the tool changes >= to >
if basket_total > 50:
    charge = 0.0

# This test passes against BOTH versions, so the mutant survives
def test_large_basket_gets_free_delivery():
    assert delivery_charge(80.00, False, False) == 0.0

# This boundary test fails against the mutant, so it's killed
def test_exactly_fifty_pounds_gets_free_delivery():
    assert delivery_charge(50.00, False, False) == 0.0
# Original rule: free delivery from £50
if basket_total >= 50:
    charge = 0.0

# Mutant: the tool changes >= to >
if basket_total > 50:
    charge = 0.0

# This test passes against BOTH versions, so the mutant survives
def test_large_basket_gets_free_delivery():
    assert delivery_charge(80.00, False, False) == 0.0

# This boundary test fails against the mutant, so it's killed
def test_exactly_fifty_pounds_gets_free_delivery():
    assert delivery_charge(50.00, False, False) == 0.0
# Original rule: free delivery from £50
if basket_total >= 50:
    charge = 0.0

# Mutant: the tool changes >= to >
if basket_total > 50:
    charge = 0.0

# This test passes against BOTH versions, so the mutant survives
def test_large_basket_gets_free_delivery():
    assert delivery_charge(80.00, False, False) == 0.0

# This boundary test fails against the mutant, so it's killed
def test_exactly_fifty_pounds_gets_free_delivery():
    assert delivery_charge(50.00, False, False) == 0.0
# Original rule: free delivery from £50
if basket_total >= 50:
    charge = 0.0

# Mutant: the tool changes >= to >
if basket_total > 50:
    charge = 0.0

# This test passes against BOTH versions, so the mutant survives
def test_large_basket_gets_free_delivery():
    assert delivery_charge(80.00, False, False) == 0.0

# This boundary test fails against the mutant, so it's killed
def test_exactly_fifty_pounds_gets_free_delivery():
    assert delivery_charge(50.00, False, False) == 0.0

Mutation score = (mutants killed ÷ total mutants) × 100

Tools like PIT for Java, Stryker for JavaScript and mutmut for Python automate this. A high mutation score means your tests check behaviour, not just run code.



Test Coverage Across the Delivery Lifecycle

  • While coding: unit tests with statement and branch coverage, with pre-commit or pull request checks so untested code doesn't merge.

  • During integration: API and contract coverage, catching problems unit tests miss because they test parts in isolation.

  • During system testing: user journey and requirements coverage, proving the product works the way people use it.

  • Before release: a coverage review to find remaining gaps, risk-based focus for final testing, mutation testing on critical logic, and coverage gates for the go or no-go decision.

  • After release: every production defect points to a missing test. Add one, so the same gap doesn't reopen.



How to Build an Effective Coverage Strategy

  1. Start with Requirements

Begin with what the business needs, not with code structure. Map tests to requirements first, then use code metrics to find what those tests missed.


  1. Layer the Techniques

Unit coverage checks parts, integration and API coverage check connections, journey coverage checks whole tasks, and requirements coverage checks business intent. Each layer catches defects the others miss.


  1. Measure Automatically

Report coverage on every build in your CI/CD pipeline. Set gates that stop coverage falling below agreed levels, and track the trend, not just the number.


  1. Set Targets by Risk

Apply higher targets to authentication, payments and pricing than to logging or admin screens. One blanket percentage wastes effort in some places and under-protects others.



Common Test Coverage Mistakes

  • Chasing the percentage: tests that run code without checking results inflate the number and add false confidence. Strong assertions matter more than a higher figure.

  • Only testing the happy path: production failures usually come from errors, edge cases and unexpected input. Cover the "no" paths too.

  • Treating all code the same: sensitive logic deserves more coverage than utilities.

  • Measuring without acting: a coverage report changes nothing on its own. Turn each gap into a test or an accepted, named risk.

  • Neglecting integration: high unit coverage can hide untested connections. Balance it with integration and journey coverage.

  • Letting coverage decay: new code without tests erodes coverage quietly. Gate pull requests and watch trends.



How AI Helps Grow Coverage

Growing coverage by hand has always meant a trade-off: every new test takes time to write, and every existing test takes time to maintain. AI changes both sides.

  • Drafting tests from requirements: AI agents read stories and specs and draft tests for each requirement, so requirements without tests become visible straight away. A person reviews and approves each draft.

  • Writing tests in plain English: business analysts and testers who know the rules can write tests themselves, without code.

  • Less upkeep: when the UI changes, the tool proposes the updated step for someone to approve, so maintenance stops eating the time meant for new coverage.

  • Data variety: one journey can run across a table of data combinations, raising data coverage without new tests.



Close Requirement and Journey Gaps with Virtuoso QA

Code coverage tools tell developers which lines ran. They can't tell a QA lead which requirements have no test, or which customer journeys have never been tried end to end. That's the gap Virtuoso QA is built to close.

  • Requirements that can't hide: Touchstone reads your specs, stories and process documents, turns them into requirements that cite their source, and drafts the journeys that prove each one. A requirement with no journey shows up as a gap, not a surprise.

  • Every requirement linked to a result: each run is tied to the requirement it checks and the person who approved the test, so requirements coverage is a live view, not a spreadsheet updated before audits.

  • Journeys, not just functions: one plain English journey can cover the screen, the API and the database, so a checkout is covered from the first click to the stored order.

  • Data and environment coverage without more tests: a single journey runs across a data table of customers, amounts and addresses, and across 2,000+ browser and OS combinations in parallel.

  • Coverage that doesn't decay: when a release changes the UI, broken steps come back as suggested edits to approve, so time goes on new coverage instead of repairs.

Virtuoso QA's agentic test generation turns your requirements into source-cited, approved journeys, shows which requirements still have no test, and runs every journey on every release, so coverage grows with your product instead of falling behind it.



Related Reads

Test Coverage Techniques FAQs

What are the main test coverage techniques?

What's the difference between statement and branch coverage?

What is a good test coverage percentage?

Is 100% code coverage enough?

What is MC/DC coverage?

How do you measure requirements coverage?

Written by

Rishabh Kumar

AI Testing & Quality Engineering Contributor

Rishabh leads business development and marketing at Virtuoso QA. He writes about AI-powered test automation, end-to-end testing, self-healing tests, and quality engineering, exploring how these capabilities can improve test coverage, reduce test maintenance, and support reliable software releases.

See what your next release looks like with Virtuoso

Book a walkthrough on your applications and your workflows. Bring a requirement, a user journey, or a brittle Selenium script, and watch the loop run on something you recognise.

See what your next release looks like with Virtuoso

Book a walkthrough on your applications and your workflows. Bring a requirement, a user journey, or a brittle Selenium script, and watch the loop run on something you recognise.

See what your next release looks like with Virtuoso

Book a walkthrough on your applications and your workflows. Bring a requirement, a user journey, or a brittle Selenium script, and watch the loop run on something you recognise.

Virtuoso QA is establishing the standard of proof for software releases. Its governed QA loop turns business requirements into tests for any browser-based application: AI proposes, a deterministic engine executes, a person approves what matters, and every decision leaves evidence.

Trust Center

AICPA

SOC

WAVE STRONG PERFORMER

@ Copyright 2026 SpotQA, Creators of Virtuoso QA

Virtuoso QA is establishing the standard of proof for software releases. Its governed QA loop turns business requirements into tests for any browser-based application: AI proposes, a deterministic engine executes, a person approves what matters, and every decision leaves evidence.

Trust Center

AICPA

SOC

WAVE STRONG PERFORMER

@ Copyright 2026 SpotQA, Creators of Virtuoso QA

Virtuoso QA is establishing the standard of proof for software releases. Its governed QA loop turns business requirements into tests for any browser-based application: AI proposes, a deterministic engine executes, a person approves what matters, and every decision leaves evidence.

Trust Center

AICPA

SOC

WAVE STRONG PERFORMER

@ Copyright 2026 SpotQA, Creators of Virtuoso QA