[Raleigh-talk] Testing

Michael Peters mpeters at plusthree.com
Wed Feb 4 12:50:46 PST 2009


Trevor Little wrote:
> I was wondering how many of you write tests for your code on a regular 
> basis. 

All the time, for everything I do! After you drink the kool-aid you'll be amazed at how much easier 
it makes your life for even moderately complicated projects. Not only does it help you verify that 
you've fixed bugs and make it easier to add new features, but you can completely change the 
internals of things without having to worry that you've broken everything.

An example: I was talking to a friend of mine who used to work for PlusThree about some of the new 
things we were doing in the current release of our main product. And I told him about how we were 
fixing the big naming mess that our database tables and columns had gotten in to just because the 
product grew organically. He said something to the effect of "Yeah, we could never do that at 
$new_job. We have no test suite."

> What modules do you use to make that easier? I'm familiar with 
> the Test::{Simple,More,Deep,...} family, but are there others anyone has 
> used and likes? 

My favorite test modules are:
Test::WWW::Mechanize
Test::HTML::Content
Test::LongString
Test::Class
Test::Differences
Test::File
Test::Exception

> Does anyone work in a place were unit testing is 
> enforced or at least strongly encouraged? 

We don't beat you with bamboo if you don't write tests, but we always build in time for writing 
tests when we're making estimates and timelines for projects.

> I guess I'm just trying to 
> figure out how other companies/people approach this kind of unit testing.

Our main project has (at the time of this email) 21,262 tests in 251 test files it's a beast to run 
the whole test suite (now takes over 1:15 on my development machine). So developers just have to 
make sure to run tests they think are related to the feature/bug they are working on. And we have a 
smoke box + smolder setup to tell us when anything else breaks. I run the same basic setup for the 
Parrot project too (http://smolder.plusthree.com/app/public_projects/smoke_reports/8)

-- 
Michael Peters
Plus Three, LP



More information about the Raleigh-talk mailing list