Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

When is mocking useful?

  • TDD - Test Driven Development
  • Write application against API that is not ready yet or not controlled by you.
  • Replace a complex object with a simpler one.
  • Isolate parts of the system to test them on their own.
  • Speed up tests (e.g. eliminate remote calls, eliminate database calls).
  • Simulate cases that are hard to replicate. (What if the other system fails?)
  • Unit tests.