Testing and Refactoring (was: Re: [hackers-il] The Philosophy of Automated Tests)
- On Fri, 28 Jan 2005, Shlomi Fish wrote:
> On Saturday 15 January 2005 11:09, Adi Stav wrote:[... snipped ...]
> > Hi Shlomi,
> > So refactoring doesn't really changeI would say - write tests before and during refactoring.
> > things, unless it creates a new code path, requiring a modification in
> > the tests.
> Can refactoring actually create a new code path? As you may know, refactoring
> is improving the internal design of the program without modifying its
> external behaviour.
> Do you write the test to test this new code path before or after the
Do the refactoring at several steps, such that at the end of each step,
the piece of software has the same external behavior.
Run the tests on the original software and on the refactored software
at each step.
Add new tests as necessary to exercise cases which you did not think of
By the way, I cannot think of a case in which refactoring would add an
extra code path. At least, not in languages having adequate expressive
power (such as Python).
My opinions, as expressed in this E-mail message, are mine alone.
They do not represent the official policy of any organization with which
I may be affiliated in any way.
WARNING TO SPAMMERS: at http://www.zak.co.il/spamwarning.html