2 ms·
The only thing mocks are good for IMHO is when the real code takes too long to run. Actually testing that a function is called twice is not what you're testing
by narrator 13y ago
The only thing mocks are good for IMHO is when the real code takes too long to run. Actually testing that a function is called twice is not what you're testing and this level of coupling to the supposedly encapsulated behavior of the method is ridiculous. The method is not called "callMethodInClassFooTwice()" it's called calculateInterestRate() or whatever and as long as it does that right that's all that's important.
- lostcolony 13y agoCalls to external services and hardware, or really, any external system. It's probably quite important that your code interacts properly with the system, but you also probably don't want to interact with it every time you run the tests. Not unless you have a copy of the external system running for every developer.