Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options

Re: Setting up database connection in tests

by tobyink (Abbot)
on Sep 13, 2012 at 16:51 UTC ( #993535=note: print w/replies, xml ) Need Help??

in reply to Setting up database connection in tests

Does your module support SQLite? If so, just create a SQLite database in a temp file and test against that with DBD::SQLite.

perl -E'sub Monkey::do{say$_,for@_,do{($monkey=[caller(0)]->[3])=~s{::}{ }and$monkey}}"Monkey say"->Monkey::do'
  • Comment on Re: Setting up database connection in tests

Replies are listed 'Best First'.
Re^2: Setting up database connection in tests
by dsheroh (Prior) on Sep 14, 2012 at 08:52 UTC
    Or don't even bother with the temp file and attach SQLite to the file :memory: for an in-memory database.

      Indeed, but that couldn't be used to persist across multiple ".t" files, which was one of the criteria the OP mentioned.

      Obviously if you're using very advanced SQL features, you may not be able to support SQLite. But if you're almost able to support SQLite already, then it's certainly worth putting in the extra effort to support it fully. The benefits to your test suite will pay back your effort.

      perl -E'sub Monkey::do{say$_,for@_,do{($monkey=[caller(0)]->[3])=~s{::}{ }and$monkey}}"Monkey say"->Monkey::do'

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://993535]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (7)
As of 2017-12-18 09:25 GMT
Find Nodes?
    Voting Booth?
    What programming language do you hate the most?

    Results (475 votes). Check out past polls.