http://www.perlmonks.org?node_id=497620


in reply to Test driven development and glue code

Looking at your examples:

  • I've got a script that moves users' mailboxes into their home directories...: Write functions that return the list of users and test that; write functions that move fake files to temp directories, etc.
  • I've got another that kills processes left by users ..: Create fake processes and then kill them. Check to ensure that you killed them. Simple.

    I'm not a test-driven coding zealot though. In some cases the script is so simple it really doesn't warrant much testing. The argument for always using test-driven development is a lot like 'thou shalt use classes to code everything...so sayeth the OO God' which, as you may already know, is a bunch of nonsense. Use whatever you think is best.

    Celebrate Intellectual Diversity