As in the "setUp()" of JavaUnit.
From KentBeck on the XpMailingList:
"Reflect on your design practices. I have spent 8 years figuring out how to further decouple my objects to make them easier to test. Expensive setUp() is a design smell."
Unnecessary coupling is bad, of course. But testing real code instead of mocked code often requires extensive setup. This is not a smell unless the code is a blob. Getting around the setup by mocking means you aren't testing what needs to be tested. That is not just a smell; it's a stink.
Well, there's a trade-off, certainly. In my own experience I find that if I don't mock out some of what could be mocked out, I just write fewer tests, which exposes you to risk, too. Possibly other programmers might be more disciplined, but if I'm testing a command that commits to the database, writes to a log file, and sends out 25 emails, I'm going to test just that if I can have all the external services mocked out.
You can test those non-mocked services, too. But in my experience it makes things easier to test them in their own test case classes, as opposed to implicitly through its clients. -- francis
The other smell comes when you DON'T mock.
To write feature A, you first write test A'.
To add feature B to A, you write test B' that calls the same setUp as A'.
To add feature C to B, you write test C' that calls the same setUp as B'.
You have now coupled A to C!