~/talk

Testing Tricks with Kotlin

Talkat droidcon Berlin 2024 · 2024-07-03..07-05· [android, testing]
slides:none on file

Kotlin test hacks that speed up debugging: enable Gradle configuration cache to make repeated runs much faster, use IntelliJ’s run automatically and Control‑Shift‑R to rerun focused tests, and name tests with backticks for readable assertions. Mocking adds a big startup cost because mocking libs attach a byte-buddy agent (observed ~600 ms vs 1–4 ms for a fake), and mocking can introduce memory leaks. Diagnose leaks with a VisualVM heap dump (found 10M User instances held by an ever‑growing list). Use Roborazzi/Roboelectric for screenshot golden diffs.

AI-written summary · about

  1. 0:00Testing with Kotlin
  2. 2:32Gradle cache for faster tests
  3. 3:56Fixing failing tests
  4. 5:21Auto-run tests in IntelliJ
  5. 6:46Stack traces in logs
  6. 7:07Readable test names
  7. 8:10Test coverage in IDE
  8. 9:33Test shortcuts
  9. 9:53Mocking vs faking
  10. 11:16Mocking libraries overhead
  11. 12:22Dynamic mock complexity
  12. 14:36Memory leaks in tests
  13. 17:47Heap dumps with VisualVM
  14. 20:54Mocking memory leaks
  15. 21:15Flaky tests with Gradle
  16. 22:59Debugging coroutines
  17. 25:50DI and test scopes
  18. 28:16Screenshot testing
  19. 31:54Golden images for UI
  20. 32:58Mocking Android APIs
  21. 34:44Avoid Robolectric
  22. 35:28Closing remarks
~/search
type to search 6,249 conferences, 138,987 speakers and 185,172 talks
~/help
cmdctrl k
search every conference, speaker and series
/
focus the filter search
h
home
c
conferences
s
speakers
e
series
t
light / dark — the status bar button does the same
?
this help
esc
close this, then clear every filter — or just the search, while you are typing in it

Ignored while you are typing. Pages without a filter rail have no search to focus.