Saturday, May 27, 2006

Testing Advice?

Sean and I are both used to unit testing libraries, but now we need to broaden our reach a bit and work on an executable for CheckR. Since we really want to work test first, we need to figure out how to test it. This is something neither of us has really done. Anyone have some advice to share?

3 comments:

Gabriel Gunderson said...

I don't know what CheckR does, but for many things `expect` is a good testing tool.

http://en.wikipedia.org/wiki/Expect

Let us know what you end up using.

Eric Hodel said...

My executables all look something like this:

require 'imap_flag

IMAPFlag.run

where run is:

def self.run(args = ARGV)
options = process_args args
client = new options
client.run
end

This makes testing dead executables dead simple.

Ryan Platte said...

I second Eric. If it's hard to test (as is the case with ARGV), extract the hard-to-test part.