To Kill A Mockist

For some background on who's using mock objects and why, check out Martin Fowler's updated Mocks Aren't Stubs. There are some clear advantages to both the "classical" and "mockist" model. I appreciated his eloquent comparison between the two, and it seems to fairly represent both mindsets. I think I have a better understanding of when to turn to mock objects. And there are some interesting corollaries to my own work in managing states and expectations in state-based tests, which I someday hope I can write down. (I'm just trying to get back in the habit of writing at all first...)

But mostly I'm writing to say "Yes!" and "Thank you!" and that I very much agree with his wrapup: I really like the fact that while writing the test you focus on the result of the behavior, not how it's done. A mockist is constantly thinking about how the SUT is going to be implemented in order to write the expectations.

Of course, I suppose I'm more focused on acceptance tests at the moment, so looking under the hood feels more wrong than usual. I'll grant that there's a real place for mocking in unit testing. I just think it's smaller than some do, and I'm oddly heartened that it's not just me. :)

Reply


*
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.
  • You can use Textile markup to format text.