I'm still relatively new to TDD, and I often find myself in a trap where at some point I designed myself in a corner, trying to add new functionality.
This basically means that the API, which grew out of, say, the first 10 requirements, does not scale when adding the following requirement, and I understand that I need to do a big reorganization of existing functions, including the structure, to add something new in a nice way .
This is good, except that in this case the API will change, so all initial tests will then need to change. This is usually more than just renaming.
I assume that my question is twofold: how should I avoid getting into this position in the first place and considering that I enter it, what are safe test refactoring templates and allow new functionality with the new API to grow
Edit : a lot of great answers, experimenting with several methods. Marked as a solution, I felt most helpful.
source share