Unit testing mengesahkan unit kod individu (functions, methods, classes) secara berasingan — memeriksa bahawa setiap bahagian kecil berfungsi dengan betul dengan sendirinya. Unit test adalah pantas, fokus, dan menjadi asas kepada strategi pengujian yang baik.
Apakah itu unit test
A UNIT test verifies the smallest testable piece (a function/method) in ISOLATION:
→ test ONE thing; give inputs, check the output/behavior
→ ISOLATED from dependencies (database, network, other units) — mock/stub those
→ FAST (no real I/O), focused, deterministic
