|
|
|
|
|
by corey
919 days ago
|
|
I agree that mocks are brittle and nearly useless. If you follow SOLID principles to the extreme, you'll find that your code is separated into logic code that is pure and easy to unit test, and IO code that is very simple and can be tested by a relatively few number of integration tests. |
|
I agree preferable but sometimes you want to test the logic of the code thats actually making decisions about how and when the IO is called.
You can do it with integration tests of course but in more complex environments with lots of complex IO dependencies mocking is cheaper. Its also hard to simulate specific failures in integration tests like a specific request failing. Pretty much mocking with extra steps.
So mocking has its place as well.