Testing: how hard can it be?
summary
Builds a Watch OS SoundCloud client and implements the login flow end to end: Compose screen -> ViewModel with coroutines -> wear client callback wrapped as suspend -> Retrofit API using Moshi -> token saved to EncryptedSharedPreferences. Tests cover the flow with a mix of Compose UI unit tests, lightweight real implementations (in‑memory/sharedprefs) and mocked endpoints, use Robolectric for Android APIs and JUnit5, and include JSON fixtures in test resources. Tests survive a full architecture rewrite and catch parsing and integration issues early while keeping most checks fast and JVM‑bound.
AI-written summary · about
chapters (14)
- 0:00Introduction to testing
- 3:14Testing on Android is broken
- 5:45Starting the login feature
- 7:07Writing the first test
- 10:00Implementing login flow
- 13:10Testing the API client
- 17:21Saving tokens securely
- 19:47Testing Wear OS client
- 22:57Refactoring to repository pattern
- 24:46Testing JSON parsing
- 25:48UI testing with Compose
- 28:14Rethinking unit testing
- 32:56Testing pyramid revisited
- 34:22Summary and final thoughts
related talks
42mRock-Solid UI and Instrumentation Testing
35mThe real face of functional testing
38mCompose UI Testing beyond layouts
32mVenturing Into the world of RxSwift unit testing
46mEfficient Android UI Testing
43mUI testing is so easy - said no developer ever
54m10X Android Development
30mHighly testable app architecture with Mobius
