Androidは複数のテストタイプをサポートしています — ユニットテスト(ロジック、JVM上で実行)、インストルメント化されたテスト(デバイス/エミュレータ上で実行、Espressoを使用したUIテストを含む)、およびその他。良いテスト戦略は信頼性と確信を向上させます。
テストの種類
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
