Android એ ઘણા પ્રકારના testing ને સપોર્ટ કરે છે — unit tests (logic, JVM પર run કરવામાં આવે છે), instrumented tests (device/emulator પર run કરવામાં આવે છે, Espresso સાથે UI tests સહિત), અને વધુ. એક સારી testing strategy reliability અને confidence ને બધે છે.
Test types
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
