Quantcast
Channel: What's the difference between a mock & stub? - Stack Overflow
Viewing all articles
Browse latest Browse all 43

Answer by O'Rooney for What's the difference between a mock & stub?

$
0
0

Reading all the explanations above, let me try to condense:

  • Stub: a dummy piece of code that lets the test run, but you don't care what happens to it. Substitutes for real working code.
  • Mock: a dummy piece of code that you verify is called correctly as part of the test. Substitutes for real working code.
  • Spy: a dummy piece of code that intercepts and verifies some calls to real working code, avoiding the need to substitute all the real code.

Viewing all articles
Browse latest Browse all 43

Trending Articles