In another question, it was revealed that one of the pains with TDD is keeping the testing suite in sync with the codebase during and after refactoring.
Now, I'm a big fan of refactoring. I'm not going to give it up to do TDD. But I've also experienced the problems of tests written in such a way that minor refactoring leads to lots of test failures.
How do you avoid breaking tests when refactoring?
- Do you write the tests 'better'? If so, what should you look for?
- Do you avoid certain types of refactoring?
- Are there test-refactoring tools?