~/talk

Making Mock Objects More Useful

Talkat try! Swift Tokyo 2017 · 2017-03-02..03-04· [ios, testing]
slides:none on file

Shows how hand-made Swift mocks become far more useful by changing a boolean flag into a call-count integer, capturing each call’s arguments (or at least the last) and exposing a verify helper that accepts file/line so failures point to the test. Replaces brittle equality checks with predicate closures and integrates Hamcrest-style matchers (e.g., containsInAnyOrder) to ignore irrelevant order and produce rich diffy failure messages. Demonstrates a real refactor bug caught when a method was called twice.

AI-written summary · about

  1. 0:00Introduction
  2. 0:25Why do we need mock objects
  3. 2:13Cooking
  4. 2:56Waiter
  5. 4:46The most common pattern
  6. 6:05Call count
  7. 6:43Method parameters
  8. 7:06Storing arguments
  9. 7:42Unit tests
  10. 8:30Extract assertions
  11. 8:46Errormsgs
  12. 9:24Parameters
  13. 10:33Reverse Topics
  14. 11:07Fragility
  15. 12:32predicate
  16. 13:44assert
  17. 14:33error message
  18. 14:56error output
  19. 15:25hand pressed matches
  20. 15:58matchers
  21. 17:02helper
  22. 18:31failure message
  23. 19:27verify method
  24. 19:54equal to metric
  25. 20:13greater than
  26. 21:05when
  27. 21:43recommendations
  28. 22:53our goal
~/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.