Soci (Soczó Zsolt) szakmai blogja


Mocks Aren’t Stubs

Filed under: Szakmai élet,Testing — Soczó Zsolt @ 23:14

Martin Fowler bátyó szokás szerint éleslátóan ír, ezúttal a különböző Unit tesztelési módszereket elemzi ki.

Rá kellett jöjjek a cikk alapján, hogy a DP tanfolyamon Mockként tanított objektumok valójában Fake objektumok voltak. Mert hogy:

  • Dummy objects are passed around but never actually used. Usually they are just used to fill parameter lists.
  • Fake objects actually have working implementations, but usually take some shortcut which makes them not suitable for production (an in memory database is a good example).
  • 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, such as an email gateway stub that remembers the messages it ‘sent’, or maybe only how many messages it ‘sent’.
  • Mocks are what we are talking about here: objects pre-programmed with expectations which form a specification of the calls they are expected to receive.

Érdemes rászánni tíz percet, tudattágító hatású cikk.

No Comments

No comments yet.

RSS feed for comments on this post.

Sorry, the comment form is closed at this time.

Powered by WordPress