3 ms·
> Integration tests can test algorithmic acceptably well, but unit tests do not test integration code in an acceptable fashion. True, but you can have both typ
by RHSeeger 9y ago
> Integration tests can test algorithmic acceptably well, but unit tests do not test integration code in an acceptable fashion.
True, but you can have both types of tests, which lets you test algorithms (unit tests) and higher level combinations (integration tests) both in the best way. The right tool for the right job.
> Where you have algorithmic and integration code smushed together (this type of technical debt is, sadly, the norm 'in the wild'), again, integration tests work acceptably well whereas unit tests require a mess of mocks.
In many cases, you'd be better off separating the logic, which would let you have both types of tests, each for a different part of the logic.
> Integration tests do not have to be high level or slow.
No, but they are a different tool.
- crdoconnor 9y ago>True, but you can have both types of tests You can, but if your code is 95% coordination and 5% algorithmic, at most you'd want 5% unit tests. >In many cases, you'd be better off separating the logic Which is refactoring and if you're refactoring you need to have your code surrounded with tests to do it safely. And, once you've done that, if you've already written integration tests for that logic and they perform acceptably well, there may be no point in rewriting the integration test as a unit test.