Android รองรับการทดสอบหลายประเภท ได้แก่ unit test (ทดสอบ logic รันบน JVM), instrumented test (รันบนอุปกรณ์/emulator รวมถึง UI test ด้วย Espresso) และอื่น ๆ กลยุทธ์การทดสอบที่ดีช่วยเพิ่มความน่าเชื่อถือและความมั่นใจ
ประเภทของการทดสอบ
UNIT TESTS (local, on the JVM) → test logic (ViewModels, repositories, utilities):
→ fast (no device); use JUnit, Mockito/MockK (mocking), no Android framework needed
→ for business logic, data processing, ViewModels
INSTRUMENTED TESTS (on a device/emulator) → test code needing the Android framework:
→ UI tests (ESPRESSO — interact with and verify the UI), integration tests
→ slower (real device/emulator) but test real Android behavior
