3 ms·
Right... So add system/integration tests. After all what you really care about is the behaviour of the system. It can be counter-productive to unit test piece
by YZF 11y ago
Right... So add system/integration tests.
After all what you really care about is the behaviour of the system. It can be counter-productive to unit test pieces of legacy code because you may end up refactoring things at a higher level and breaking all your unit tests.
If it's clear that a piece of the legacy system stands on its own as a "unit" and has reasonable interfaces then by all means add unit tests to that. The biggest value though IMO in a "legacy" system is to add system level tests. Those are often easier to put in than unit tests, will catch problems involving multiple components, and will teach you about how the system is supposed to behave.
- kartan 11y ago> add system/integration tests. For me this is clearly the way to go. If you add unit tests to a bad designed interface you are only making it more difficult to fix. Now you don't only need to change the interface but also the tests increasing your technical debt. System tests are the best cost/value tests. You only add unit testing to stable code that is not going to change often. System tests cover the same code that the unit tests. Its only disadvantage is that - maybe - it will take more time to know what is failing when something fails as they cover a broader amount of code.