[Chicago-talk] perl tests with overhead

JT Smith jt at plainblack.com
Tue Jul 26 07:57:57 PDT 2005

I need some advice from the testing gods on this list. I have a massive perl application 
with little or no testing framework, and I want to start adding tests for everything. My 
problem is that every one of the modules requires the session layer that I've created. 
Among other things, the session layer manages the database connection. I can easily 
write tests to verify the session layer, so that's not a problem.

The problem comes in that I don't want each test to have to seperately establish a 
session before running if I can help it. What I'd like to do is create a session and 
then pass each test a reference to the session.

My questions are these:

a) Is this a bad idea? Should I just have each module establish it's own session?

b) What's the best way to do this?

c) What I thought of was making each test a perl module rather than a seperate script, 
then I can easily pass in the session object. However, will that cause problems? My 
thought is that if they're all modules theoretically one module could contaminate the 
results of another module simply because their both being loaded into memory at the same 
time. There wouldn't be any Exporter or anything so I wouldn't have to worry about 
overlapping variables and functions, but I worry none-the-less. Do you think this will 
be a problem?

Any pointers?

JT ~ Plain Black
ph: 703-286-2525 ext. 810
fax: 312-264-5382

I reject your reality, and substitute my own. ~ Adam Savage

More information about the Chicago-talk mailing list