08 May 2007

Mocking classes challenge

I'm in a communcation quandry. I'm either missing a point or can't explain something, or both.

I really don't like mocking classes, except where I'm trying to cut a seam in some legacy code, but other people disagree.

Can someone post or send me an example of code where interaction-testing with interfaces doesn't work well? Thanks

Contact me at mockexample theAtSymbol m3p theDotCharacter co anotherDotHere uk

3 comments:

Anonymous said...

The few times I've seen people do it they're just utilising a mocking framework to simplify the creation of a stub or fake... They're not really doing interaction testing though...

Steve Freeman said...

I figured there would be some of that, I was wondering if there were more complicated examples.

ulu said...

I guess it's all about complexity of your application. If it's simple enough, interfaces complicate stuff. If it's complex, interfaces make it more clear and focused. I believe that you shouldn't make a strict rule here, unless you want to have some guidance. If you feel confident, you make a choice each time you do some refactoring. If you don't, then just figure out once and follow the rule.