3 ms·
Is there such a thing as the NoMock movement?
- geophile 14y agoDumb name, but I agree with the basic point. Mock objects are a deceptively good strategy, because they work for the toy examples used to motivate them, but don't scale up. The more sophisticated your tests get, the more you rely on real object behavior that isn't mocked accurately, and you end up spending too much time discovering this, or improving your mock object, (and likely introducing other bugs that your real system doesn't have). Mocking a database is a really bad idea -- it is too easy to get transaction behavior subtly (or vastly) wrong, as mentioned; but also, there are subtleties involved in transaction isolation, sequences and auto-increment behavior, data types (especially fixed decimal and date/time), and functions. Mocking distribution may be even worse. The failures simulated locally aren't quite the same as the real thing, timing is different, and it's easy to get subtle errors due to updates to shared state (that wouldn't be shared in a real distributed system).
- henk53 14y agoYou raise some good points. At one point I've indeed fallen into the trap where I continued improving the mock object until it was a system of its own that was beginning to have bugs that had no relation to any real system the code was to run on. The mock thus became more of burden than a help, and after reading some posts of this "NoMock" movement, I realized they actually weren't even helping me. What's in a name, but what name would you suggest? :P