Test coverage วัดว่าโค้ดถูก ดำเนินการโดย test มากแค่ไหน — โดยทั่วไปเป็นเปอร์เซ็นต์ (เช่น coverage 80%) มันเป็น metric ที่มีประโยชน์สำหรับการค้นหาโค้ดที่ยังไม่ได้ทดสอบ แต่สำคัญที่ต้องเข้าใจข้อจำกัดของมัน: coverage ที่สูงไม่ได้รับประกันว่า test ดี
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.
