Testien kattavuus mittaa, kuinka suuri osa koodista suoritetaan testien avulla — tyypillisesti prosentteina (esim. 80 % kattavuus). Se on hyödyllinen mittari testaamattoman koodin löytämiseen, mutta on tärkeää ymmärtää sen rajoitukset: korkea kattavuus ei takaa hyviä testejä.
Mitä kattavuus mittaa
TEST COVERAGE = the % of code exercised by the test suite:
LINE coverage → % of code lines executed by tests
BRANCH coverage → % of branches (if/else paths) taken
FUNCTION coverage → % of functions called
STATEMENT coverage → % of statements executed
→ Coverage tools instrument the code and report what tests do/don't exercise.
