Knowledgebase

Test Coverage and Its Limits Print

  • softwaretestingqa, software, guide, howto, solution, zillionkinghost, hosting, support
  • 0

Measuring what was exercised.

WHAT COVERAGE MEASURES

The proportion of code executed during tests.

WHAT TYPES EXIST

Line coverage Branch coverage Condition coverage Path coverage

WHAT BRANCH COVERAGE ADDS OVER LINE

Whether both outcomes of each decision were taken.

WHY THAT MATTERS

Full line coverage can miss half of every condition.

WHAT COVERAGE DOES NOT MEASURE

Whether the tests assert anything meaningful Whether the right things were tested Whether behaviour is correct

WHAT PROVES THAT

A test suite with no assertions can reach high coverage.

WHAT TO USE COVERAGE FOR

Finding untested areas.

WHAT NOT TO USE IT FOR

A target to be hit.

WHY TARGETS CORRUPT IT

They produce tests written to touch code rather than verify behaviour.

WHAT A REASONABLE APPROACH IS

Review uncovered areas, and decide deliberately whether they warrant tests.

WHAT MUTATION TESTING DOES

Changes the code deliberately and checks whether tests fail.

WHAT IT REVEALS

Tests that execute code without verifying it.

WHY IT IS A BETTER MEASURE

It assesses assertion quality, not execution.

WHAT IT COSTS

Substantial running time.

WHAT TO APPLY IT TO

Critical code, periodically.


Was this answer helpful?
Back

Are you happy with your experience? Leave us a review on Trustpilot.


Trustpilot