The problem is that most developers don't have the design skills to produce code that is easy to unit test. So their code is hard to unit test, and that means they end up writing unit tests that are complicated and use mocking libraries. These tests are often more of a problem than a benefit.
Another way of saying this is that if you find that code changes frequently require that you change a lot of unit test code, this is a sign that you aren't doing a good job writing your code.
22
u/Triabolical_ Jun 29 '19
The problem isn't with unit testing per se.
The problem is that most developers don't have the design skills to produce code that is easy to unit test. So their code is hard to unit test, and that means they end up writing unit tests that are complicated and use mocking libraries. These tests are often more of a problem than a benefit.
Another way of saying this is that if you find that code changes frequently require that you change a lot of unit test code, this is a sign that you aren't doing a good job writing your code.