3 ms·
That sounds more like an argument for putting an interface in front of an implementation on the app side, and then mocking that interface in the test. Which is
by tunesmith 13y ago
That sounds more like an argument for putting an interface in front of an implementation on the app side, and then mocking that interface in the test. Which is totally fine, because then you are isolating the custom implementation (a light shell to the external library). As opposed to mocking the external implementation in the test.
- chrisguitarguy 13y agoThat's more along the lines of what a lot of TDD literature says. Write adapters or facades that wrap external libraries, use those in your own code's unit tests. This makes you less bound to a specific library as well. Don't mock the outside world [0] for testing your adapters/facades/whatever, but do integration tests that cover your adapters using the real outside world. You'd also do complete end to end tests where the entire system is used as if it were in production (acceptance testing). TDD makes a lot more sense if you think of it in those three layers: acceptance, integration, unit. [0] Outside world means anything that's not your code -- networking, filesystem, external libraries, etc.