|
|
| Think about Loose Coupling | |
| PerlMonks |
Re^2: Smallish mock objectsby adrianh (Chancellor) |
| on Dec 16, 2006 at 14:46 UTC ( #590206=note: print w/ replies, xml ) | Need Help?? |
|
I do realize that some module simple can't be loaded easily (some of the Apache ones, for example), so mock objects would be appropriate there, but otherwise, I don't think it's worth the trouble. I only find myself using them when I have some state in the "mock" object that's hard to reproduce in a "live" object (e.g rare error conditions, etc.) or when I'm dealing with third party code. I have to admit I rarely use any of the CPAN modules for mocking and do something like:
rather than:
Probably because I don't use them enough for the API to be familiar to me. The pro-/anti-mock argument seems to occur every few months on the TDD mailing list :-) Google around for "state based testing" vs "interaction based testing".
In Section
Snippets Section
|
|
||||||||||||||||||||||||||||