Beefy Boxes and Bandwidth Generously Provided by pair Networks
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??


in reply to Refactoring makes unit tests obsolete

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        

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://401399]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others about the Monastery: (7)
As of 2024-03-28 16:03 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found