Test coverage mengukur sebanyak mana kod dilaksanakan oleh ujian — biasanya sebagai peratusan (cth. 80% coverage). Ia merupakan metrik berguna untuk mencari kod yang tidak diuji, tetapi penting untuk memahami batasannya: coverage tinggi tidak menjamin ujian yang baik.
Apa yang diukur oleh coverage
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.
