~/talk

Real World Mocking in Swift

Talkat try! Swift Tokyo 2016 · 2016-03-10..03-12· [testing, swift]
slides:none on file

Argues OCMock-style runtime patching is impractical in Swift so teams end up writing their own test doubles, demonstrates replacing NSURLSession with a mock and injecting it to assert the request URL, and warns that partial mocks are an anti-pattern because they’re fragile and hard to reason about. Recommends using protocols over subclassing and constructor injection for testability, prefers more value types to avoid mocks, and notes emerging helpers like Kaku plus other framework approaches that generate or simplify mocks.

AI-written summary · about

  1. 0:00Intro
  2. 0:37Asynchronous tests
  3. 1:16Mock frameworks
  4. 2:49Mocks take time
  5. 3:40Why Mocks
  6. 5:07Why Tests
  7. 6:47Dependency Injection
  8. 8:29Why use Dependency Injection
  9. 10:31stub API
  10. 11:38time machine
  11. 13:41Mocking
  12. 16:15Best Practices
  13. 17:52NSUserDefaults
  14. 19:05Time Traveler
  15. 20:28Controlling Complexity
  16. 24:14Future of Mocking
~/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.