Re: Using refactoring to make code more testable Re: [refactoring] Using refactoring to make code more testable
Adrian Howard <[email protected]>
| Newsgroups | gmane.comp.programming.refactoring |
|---|---|
| Message-ID | <[email protected]> |
On 11 Oct 2009, at 20:48, Richard wrote:
[snip]
> Don't write tests just for the sake of writing tests, particularly on
> legacy code. The changes you need to make to legacy code in order to
> make it testable can just as likely introduce defects as they will
> make the code testable.
[snip]
In addition it's been my experience that folk who just add tests for
the sake of adding tests end up with a very fragile test suite -
because they have to add a bunch of extra infrastructure to the test
suite to deal with the non-TDD code the tests tend to produce a lot of
false-fails. This is especially harmful when you're trying to
introduce tests into a team coz people quickly stop trusting the tests.
> If you have defects to fix in that legacy code, then do traditional
> debugging to find the location of the fault and then do a minimal
> amount of decoupling around the fault so you can write a failing test,
> fix the fault and get a passing test. Leave the rest alone.
That's what I'd do too. With maybe a few story-level tests on the top
if I thought they'd have any long term value.
Adrian
--
http://quietstars.com - twitter.com/adrianh - delicious.com/adrianh
------------------------------------
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/refactoring/
<*> Your email settings:
Individual Email | Traditional
<*> To change settings online go to:
http://groups.yahoo.com/group/refactoring/join
(Yahoo! ID required)
<*> To change settings via email:
mailto:[email protected]
mailto:[email protected]
<*> To unsubscribe from this group, send an email to:
[email protected]
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/