Pokrycie testami mierzy, jak dużą część kodu wykonują testy — zwykle wyrażane jako procent (np. 80% pokrycia). Jest to przydatna miara do znajdowania nieprzetestowanego kodu, ale ważne jest zrozumienie jej ograniczeń: wysokie pokrycie nie gwarantuje dobrych testów.
Co mierzy pokrycie
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.
