Android supporta diversi tipi di test — unit test (logica, eseguiti sulla JVM), instrumented test (eseguiti su dispositivo/emulatore, inclusi test UI con Espresso), e altri. Una buona strategia di testing migliora l'affidabilità e la confidenza.
Tipi di 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
