Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Reusing tests against multiple databases

by astroboy (Chaplain)
on Apr 22, 2010 at 23:42 UTC ( [id://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.

Replies are listed 'Best First'.
Re: Reusing tests against multiple databases
by GrandFather (Saint) 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
Domain Nodelet?
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?Last hourOther CB clients
Other Users?
Others wandering the Monastery: (5)
As of 2024-03-29 13:40 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found