Mocks are objects
pre-programmed with expectations which form a specification of the
calls they are expected to receive.
Stubs provide canned answers to calls made during the test,
usually not responding at all to anything outside what's
programmed in for the test. Stubs may also record information
about calls.
Mocks insist upon behavior
verification.
Stubs use state verification.
For a Stub you have already written with predetermined behavior.
A Mock is something that as part of your test you have to setup with your expectations.
References;
http://stackoverflow.com/questions/3459287/whats-the-difference-between-a-mock-stub
http://martinfowler.com/articles/mocksArentStubs.html
http://www.drdobbs.com/testing/using-mocks-in-python/240168251
No comments:
Post a Comment