Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re: Testing & Databases

by Abigail-II (Bishop)
on Jan 28, 2004 at 11:59 UTC ( [id://324653]=note: print w/replies, xml ) Need Help??


in reply to Testing & Databases

There are various ways to deal with this. Ideally, you don't have to change anything in your script, and you don't make any if ($ENV {TEST}) style decisions either.

Realize that to connect to a database, you have to give some pieces of information - one of them the name to the database server. Suppose one of your database servers (logical) name is grapefruit. Then make it so that in your production environment grapefruit points to the production database, and in your testing environment, grapefruit points to your testing database.

The advantage is that you only have to do this once, and every program can benefit from it. It also prevents you from accidentely accessing a production database from a testing environment because you set the wrong environment variable, or used the wrong configuration file.

Abigail

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others exploiting the Monastery: (2)
As of 2024-04-24 17:51 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found