Mutation testing ประเมิน คุณภาพของ test suite โดยการจงใจใส่บั๊กเล็ก ๆ ("mutant") เข้าไปในโค้ดและตรวจสอบว่าเทสต์ จับมันได้หรือไม่ มันวัดว่าเทสต์ดีแค่ไหนจริง ๆ ในการตรวจจับข้อบกพร่อง — ไปไกลกว่า coverage ที่วัดเพียงการรัน
Mutation testing ทำงานอย่างไร
1. A tool makes small changes (MUTATIONS) to the code, e.g.:
→ change + to -, > to >=, true to false, remove a statement, change a constant
→ each mutation = a deliberate "bug" (a MUTANT version of the code)
2. Run the TEST SUITE against each mutant:
→ tests FAIL → the mutant is "KILLED" (good — tests caught the bug) ✓
→ tests PASS → the mutant "SURVIVED" (bad — tests DIDN'T catch the bug) ✗
3. MUTATION SCORE = % of mutants killed → measures how good the tests are at catching bugs
