Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re: Testing and database date functions

by pernod (Chaplain)
on Dec 09, 2004 at 16:42 UTC ( [id://413614]=note: print w/replies, xml ) Need Help??


in reply to Testing and database date functions

Take a look at Test::MockObject. What you are trying to test is the script, not the database, therefore you can fake the database (and its date and dayofweek functions) using MockObjects.

Do a super search on Test::MockObject to see some other uses of mocking. It is a very powerful technique that allows you to concentrate on the main job of your code, and it allows you to keep testdata and tests in the same place.

Good luck!

pernod
--
Mischief. Mayhem. Soap.

  • Comment on Re: Testing and database date functions

Replies are listed 'Best First'.
Re^2: Testing and database date functions
by lachoy (Parson) on Dec 09, 2004 at 17:34 UTC
    Even better, check out DBD::Mock which is meant to transparently replace your database connection allows you to specify resultsets. You could seed the connection with any results you want no matter what day it is.

    Chris
    M-x auto-bs-mode

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://413614]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others sharing their wisdom with the Monastery: (6)
As of 2024-04-16 09:04 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found