Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re: how to begin with testing?

by gwadej (Chaplain)
on Mar 23, 2009 at 13:33 UTC ( #752586=note: print w/ replies, xml ) Need Help??


in reply to how to begin with testing?

There's been a lot of great advice here, but I thought I would chime in with a different reference. I found the book Working Effectively with Legacy Code by Michael Feathers to be quite good for this particular issue.

One thing that Feathers covers that most other testing books don't is that the normal unit testing approach does not usually work well with legacy code (which he defines as code with no tests). He suggested a tactic he calls characterization tests. Instead of trying to verify correct behavior as you would with unit tests, characterization tests focus on current behavior.

Before making changes to legacy code (bug fixes, feature additions, refactorings, etc.), you would start by characterizing the current code, in the area of interest, with tests. Then, you can modify the tests and code in something approximating normal unit testing.

One of the most important points in the book is the explanation of the different tactics that you need to use for legacy code and new code that can be properly unit tested.

G. Wade


Comment on Re: how to begin with testing?
Re^2: how to begin with testing?
by jhourcle (Prior) on Mar 23, 2009 at 14:33 UTC

    I'm not familiar with that specific book, but when you mentioned 'Legacy Code', I was reminded of Peter J. Scott's book Perl Medic: Transforming Legacy Code. It also deal with being handed existing code, and having to maintain it. The third chapter covers tests -- it's not as complete as chromatic's book, but it does give an overview of the perl modules in CPAN (at the time) to handle testing.

      All three books complement each other. If you can read all three, I recommend it.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (11)
As of 2014-09-03 07:31 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite cookbook is:










    Results (35 votes), past polls