Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re: Testing & Databases

by adrianh (Chancellor)
on Jan 28, 2004 at 11:25 UTC ( [id://324644]=note: print w/replies, xml ) Need Help??


in reply to Testing & Databases

My first idea was to have a second DB to be used during testing. The problem is that to use the other DB, I have to intersperse my production code with snippets like $db="dbi:mysql:test_db" if $ENV{'test'} or likewise. Which seems not to elegant to me...

The fact that you have to have to have snippets is probably a sign that you need to add some kind of application configuration layer. Duplication is always a bad sign.

Once you're always fetching your DBI string from My::App::Configuration (or whatever) you only have one place where you need to tweak settings for the test environment and the problem becomes a lot simpler.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others chilling in the Monastery: (5)
As of 2024-03-29 08:00 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found