ਟੈਸਟ ਕਵਰੇਜ ਇਹ ਮਾਪਦੀ ਹੈ ਕਿ ਕੋਡ ਦਾ ਕਿੰਨਾ ਹਿੱਸਾ ਟੈਸਟਾਂ ਦੁਆਰਾ ਚਲਾਇਆ ਜਾਂਦਾ ਹੈ — ਆਮ ਤੌਰ 'ਤੇ ਪ੍ਰਤੀਸ਼ਤ ਦੇ ਰੂਪ ਵਿੱਚ (ਜਿਵੇਂ 80% ਕਵਰੇਜ)। ਇਹ ਪਰੀਖਿਅਤ ਕੀਤੇ ਨਾ ਗਏ ਕੋਡ ਨੂੰ ਲੱਭਣ ਲਈ ਇੱਕ ਉਪਯੋਗੀ ਮੈਟ੍ਰਿਕ ਹੈ, ਪਰ ਇਸ ਦੀਆਂ ਸੀਮਾਵਾਂ ਨੂੰ ਸਮਝਣਾ ਮਹੱਤਵਪੂਰਨ ਹੈ: ਉੱਚ ਕਵਰੇਜ ਚੰਗੇ ਟੈਸਟਾਂ ਦੀ ਗ਼ੈਰੰਟੀ ਨਹੀਂ ਦਿੰਦੀ।
ਕਵਰੇਜ ਕੀ ਮਾਪਦਾ ਹੈ
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.
