Android suporta vários tipos de testes — testes unitários (lógica, executados na JVM), testes instrumentados (executados em um dispositivo/emulador, incluindo testes de UI com Espresso), e mais. Uma boa estratégia de testes melhora a confiabilidade e a confiança.
Tipos de testes
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
