Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re: Has anyone ever written DBD::MockDB

by waswas-fng (Curate)
on Apr 06, 2004 at 22:55 UTC ( [id://343158]=note: print w/replies, xml ) Need Help??


in reply to Has anyone ever written DBD::MockDB

I guess I am missing the point, wouldn't testing the actual functionality of the DB backend and data integrity via the used DBI/DBD and in source SQL be the goal of the DBI related test harness for your application? Doesn't using a fake DB remove one of the possible fail points that actually exists in the application that uses DBI? =) How about a module that replaces your app's subs with print's that output what your harness expects -- seems like another way to simplify your tests. =)


-Waswas

Replies are listed 'Best First'.
Re: Re: Has anyone ever written DBD::MockDB
by stvn (Monsignor) on Apr 06, 2004 at 23:25 UTC

    The idea is two fold:

    1. It is sometimes very difficult to get a real database to act in all the ways you want to test against without having to jump through hoops. For instance, with a mock DB object, testing how your app will perform when the DB connection goes down can be automated by making the mock DB object mimic that. To replicate this in reality and automate it would be difficult at best.
    2. Mock objects do not test the actions of the objects they are mocking (the DB in this case) but the objects which use it. So in my particular instance I want to test my objects that use the database, but I really dont care about the database, as that is not (in this case) relevant to the test itself.
    This site http://www.mockobjects.com and in particular the FAQ are great introductions to the idea behind Mock objects.

    -stvn

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others examining the Monastery: (4)
As of 2024-04-26 09:09 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found