go ahead... be a heretic | |
PerlMonks |
Re: Refactoring makes unit tests obsolete (yes&no)by tye (Sage) |
on Oct 22, 2004 at 06:44 UTC ( [id://401399]=note: print w/replies, xml ) | Need Help?? |
One method (or goal) of UT is to cover ever path of execution (where you can interpret that as 'every combination' or 'every line'). You can sometimes do quite a bit of refactoring without changing the basic decision points and your UT remains as perfect a fit as before. You can also drastically refactor the code but keep the basic purpose intact. Much of your old UT should still pass (or can be adapted to take into account rather peripheral changes such as API adjustments but still be a useful set of tests). Sometimes the old UT becomes mostly useless. But you usually don't refactor the entire system at once so you'll have API contracts with other parts above and below and the UT should stress the bounds of these contracts. So, at the least, your old UT should give you a good indication of whether the old contracts are still appropriate and how much you'll need to modify the consumers of the refactored code in order to use it. - tye
In Section
Meditations
|
|