Pathologically Eclectic Rubbish Lister | |
PerlMonks |
Re: Testing & Databasesby Abigail-II (Bishop) |
on Jan 28, 2004 at 11:59 UTC ( [id://324653]=note: print w/replies, xml ) | Need Help?? |
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
In Section
Seekers of Perl Wisdom
|
|