3 ms·
I was thinking more of the case where the 3rd party library does no network communication. If it still takes a long time to execute, that may be a concern. But
by michaelmior 12y ago
I was thinking more of the case where the 3rd party library does no network communication. If it still takes a long time to execute, that may be a concern. But if the output is complex, then mocking it may be more trouble than it's worth.
For network requests to an API, your option #2 is exactly what I was suggesting.
- SideburnsOfDoom 12y agoI'm not familiar with VCR, but it looks like it's a little similar to https://docs.angularjs.org/api/ngMock/service/$httpBackend https://docs.angularjs.org/api/ngMock/service/$httpBackend There's a lot of value in coarse-grained mocks like this for testing the system; I also find value in finer grained mocks for testing smaller components in isolation. But neither of these techniques is the only valid one. And neither of them forces you to write things upfront that you don't need later; which is what the original article seems to imply.
- michaelmior 12y agoVCR seems similar to $httpBackend. The main difference is that it automatically records the HTTP response from the target server the first time tests are executed. Then it allows you to reuse that response in future test runs to save having to manually mock responses. Anyway, sounds like we're more or less agreeing :)