Ruby / Rails / Agile / Productivity / Vim / ЗОЖ

TDD Resources


J.B. Rainsberger – Integrated Tests Are A Scam

  • They don’t put pressure to the design
  • You can’t possibly test all cases
  • Introduce “Collaboration” tests
  • Introduce “Contract” tests

Chris Parsons – Your Tests Are Lying To You

  • Some tests are saying they’re Unit, but they’re actually Integration
  • Good design is easy to test – Corey Haines
  • Mockist vs Classist
  • Mocks are isolated, fast & tell you about design flaws

Sandi Metz – The Design of Tests

  • Messages to self – rarely tested
  • Incoming messages – assert on result
  • Outgoing messages – test for calling
  • Outgoing queries – don’t test!
  • Outgoing commands – expectations on mocks


Martin Fowler – Mocks Aren’t Stubs

  • Mockist & behavior design VS Classist & STATE

Corey Haines – Yay! Mocks!

  • Mocks lead to better design that easy to change
  • OO design is about interactions & roles
  • Delegate the “How”
  • Don’t let mocks depend on other mocks

Gregory Moeck – Why You Don’t Get Mock Objects

  • Mocks assert on messages
  • Stub returns value
  • Mock Roles, not concrete objects.

Gary Bernhardt – Test Isolation Is About Avoiding Mocks

  • Nested stubs are telling something about the design
  • Good TDDers don’t write nested mocks
  • We write huge functions because there’s no pressure of testing them isolated.
  • Isolated tests are microscope of object interactions
  • Don’t let your tests make code less readable
  • Don’t isolate “Collaborator” classes

Piotr Solnica – Mocking and Ruby

  • Mock only what you own If you don’t own it, you don’t have control on it’s evolution
  • Don’t mock just for speed
  • Be aware that mocks introduce maintenance costs
  • Keep mocks simple
  • Mock rarely

Is TDD Dead?

series: Part 1 – 5