I finally convinced myself to write some test for an app I'm currently developing (or rather starting to develop). It's a run-of-the-mill webbased DB-thing, using mod_perl, TT, Class::DBI as it's main components.
I know basic testing stuff, but there's one thing I haven't got a decent solution for, which is why I'm seeking help here.
I want to test DB operations etc, i.e. create some entries, update, delete them, etc. Now, my problem is that all this testing interfers with the 'real' data if I run the tests against the 'real' database.
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...
Another idea was to have testing DBs on the dev-boxes and the 'proper' DB on the production box. But this way I couldn't run the test suite on the production box, which seems not perfect, either.
So, has anybody got some ideas / pointers on how to solve this kind of testing problems?
-- #!/usr/bin/perl for(ref bless{},just'another'perl'hacker){s-:+-$"-g&&print$_.$/}
In reply to Testing & Databases by domm
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |