Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Reusing tests against multiple databases

by astroboy (Chaplain)
on Apr 22, 2010 at 23:42 UTC ( #836366=perlquestion: print w/ replies, xml ) Need Help??
astroboy has asked for the wisdom of the Perl Monks concerning the following question:

Hi there

I have some tests that need to run against multiple database products (SQLite, MySQL and Oracle), and am trying to determine the best way to organise them so that the tests can be reused. How does everyone else do this?

Here's an approach that I figured might work: I could use Test::Class and in my base class I'd create the schema/database in a startup method, and then I'd remove it in the shutdown method. My test classes would inherit from the base class. But what's the best approach to tell the startup and shutdown methods which vendor-related ddl scripts to run?

Advice appreciated.

Comment on Reusing tests against multiple databases
Re: Reusing tests against multiple databases
by GrandFather (Cardinal) on Apr 23, 2010 at 01:17 UTC

    I have a bunch of code I run tests against for SQLite and MySQL databases. I simply pass the DBI connect parameters into a test routine that opens the DB handle and runs the tests against it (in fact it actually passes the parameters through to an object constructor, but same difference).

    If you need special processing for the individual database engines shouldn't that be handled by the code under test? If not then add the handling for that to the test code.

    True laziness is hard work

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://836366]
Approved by AnomalousMonk
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (2)
As of 2014-09-18 00:03 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (101 votes), past polls