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.
In reply to Re: Testing & Databases
by adrianh
in thread Testing & Databases
by domm
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |