~/talk

Beyond the Mockery: Why We Should Embrace Testing Without Mocking Frameworks

Talkat droidcon Berlin 2023 · 2023-07-05..07-07· [testing]
slides:none on file

Argues that framework-generated mocks (Mockito) introduce runtime bytecode generation, shared mutable test state and brittle, API-unsafe stubs; shows a coffee‑maker example swapping a heater and pump to demonstrate constructor injection, Kotlin stubs and in-memory fakes that compile-safe catch API changes, and a fake that records interactions to verify outcomes. Recommends use fakes and stubs over runtime mocks, leverage Kotlin functional interfaces and IntelliJ refactor tools, and avoid mocking classes you own.

AI-written summary · about

  1. 0:00Introduction and motivation
  2. 1:08Why testing matters in legacy projects
  3. 6:24Kotlin's role in better testing
  4. 11:20Refactoring dependencies for testability
  5. 14:08The problems with mocking frameworks
  6. 20:29Shared mutable state and test instability
  7. 25:42Stubs and fakes as better alternatives
  8. 30:35Interface segregation and seams
  9. 34:02Android's legacy challenges
  10. 36:31Conclusion and final thoughts
~/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.