4 ms·
> "Isn't the whole promise of testing is easier maintenance in the long run?" Yes, but the structure of the tests matters. Generally speaking there are two maj
by ZenoArrow 11y ago
> "Isn't the whole promise of testing is easier maintenance in the long run?"
Yes, but the structure of the tests matters. Generally speaking there are two major problem areas to avoid with unit tests:
1. Unit tests that are too close in design to the specific implementation. What this means is that instead of testing the desired behaviour in an abstract way, you mirror the design decisions made in the code being tested. When the code being tested changes, this can break the unit test, even if the new code has the desired behaviour.
2. Test-induced design damage. Unit testing relies on being able to isolate the code being tested. This can lead to an increase in code complexity, as well as a less flexible design.
Both of these issues can be overcome, but it does mean that you have to consider what to test and how to test it, as badly applied tests can cause maintenance issues.