If testing is hard, it may be an indication that the code needs to improve
Noel Rappin said: "I think that tests are a really important guide to knowing if your code is getting too complicated. If it becomes hard to write tests, a lot of people have the situation where they start using testing and maybe they don't refactor or they don't know what to refactor. They know that they should use RSpec but they don't have the experience or a helpful person nearby to guide them through the process. And they get to the point where the code gets a little bit convoluted. And the tests get harder to write, because they need more setup. There are more objects. The objects relate in complicated ways. You need a lot of different objects set up. And then they go, "Oh, these tests are really hard to write. I give up."
And I think the thing is that when the tests get hard to write in a TDD process, you think of that as evidence that the code is too complicated. So, that's a strong guide. If you need to create a lot of different objects in order to run a unit test that tests a single method, that's often a sign that your code is too complicated. Now, what you can do about that is an open question. And it depends on what your setup is. I do not advocate…"