Re: Using refactoring to make code more testable

George Dinwiddie <[email protected]>
Newsgroups gmane.comp.programming.refactoring
Organization iDIA Computing, LLC
Message-ID <[email protected]>
[email protected] wrote:
> Oops ment to save this as a draft. I have largish code base (roughly
> 10 million lines) that my company deals with and a much smaller code
> base (roughly 250 thousand lines) my team deals with. Currently there
> is no unit test coverage of any of the code. And the code was not
> wrote to be tested. My main task is to get the code covered.  I was
> wondering what kind of refactoring strategies would help make this
> goal attainable?

First, read Michael Feathers' book, Working Effectively With Legacy 
Code.  It will help you find or create seams for testing.

Write tests that cover largish chunks of the system as /characterization 
tests/.  These are tests that characterize what the system currently 
does, whether that's right or wrong.  That will let you see when 
something changes, and you can investigate.

Then, as you work on the system, further isolate the part you're 
changing and add more fine-grained tests around that part.  TDD any new 
code you write.

It takes time, but this is a strategy that works.

  - George

-- 
  ----------------------------------------------------------------------
   * George Dinwiddie *                      http://blog.gdinwiddie.com
   Software Development                    http://www.idiacomputing.com
   Consultant and Coach                    http://www.agilemaryland.org
  ----------------------------------------------------------------------



------------------------------------

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/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.