Too often, I hear people say “It’s test code, don’t worry about it.” Well, I disagree. I think the quality of your test code is reflective of the code base in general. The same issues that we have have with the test code we will have with production code. If you see duplication, high complexity, low cohesion, etc. in the tests, odds are you are going to see it in the production code base.
The tests and the supporting code need to be well factored. If a “small” change in the production code is going to result in a large amount of painful changes in test code we are less likely to make the proper changes. And thus begins the downward slide.
It is better to apply DRY and SOLID principles every time we write test code. We get more time practicing the discipline needed to write quality code, and we set ourselves up for an easier time in the future.