Android understøtter flere testtyper — unit tests (logik, køres på JVM), instrumented tests (køres på enhed/emulator, inklusiv UI-tests med Espresso), og mere. En god teststrategi forbedrer pålidelighed og tillid.
Testtyper
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
