Android कई प्रकार के testing का समर्थन करता है — unit tests (logic, JVM पर चलते हैं), instrumented tests (device/emulator पर चलते हैं, Espresso के साथ UI tests सहित), और अन्य। एक अच्छी testing strategy reliability और confidence बढ़ाती है।
test प्रकार
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
