Mock database driver for testing

Edit Package perl-DBD-Mock
http://search.cpan.org/dist/DBD-Mock/

Testing with databases can be tricky. If you are developing a system
married to a single database then you can make some assumptions about your
environment and ask the user to provide relevant connection information.
But if you need to test a framework that uses DBI, particularly a framework
that uses different types of persistence schemes, then it may be more
useful to simply verify what the framework is trying to do -- ensure the
right SQL is generated and that the correct parameters are bound.
'DBD::Mock' makes it easy to just modify your configuration (presumably
held outside your code) and just use it instead of 'DBD::Foo' (like the
DBD::Pg manpage or the DBD::mysql manpage) in your framework.

There is no distinct area where using this module makes sense. (Some people
may successfully argue that this is a solution looking for a problem...)
Indeed, if you can assume your users have something like the DBD::AnyData
manpage or the DBD::SQLite manpage or if you do not mind creating a
dependency on them then it makes far more sense to use these legitimate
driver implementations and test your application in the real world -- at
least as much of the real world as you can create in your tests...

And if your database handle exists as a package variable or something else
easily replaced at test-time then it may make more sense to use the
Test::MockObject manpage to create a fully dynamic handle. There is an
excellent article by chromatic about using the Test::MockObject manpage in
this and other ways, strongly recommended. (See the SEE ALSO manpage for a
link)

Refresh
Refresh
Source Files
Filename Size Changed
DBD-Mock-1.59.tar.gz 0000075533 73.8 KB
cpanspec.yml 0000000469 469 Bytes
perl-DBD-Mock.changes 0000008429 8.23 KB
perl-DBD-Mock.spec 0000003404 3.32 KB
Latest Revision
Dirk Stoecker's avatar Dirk Stoecker (dstoecker) accepted request 874811 from Tina Müller's avatar Tina Müller (tinita) (revision 18)
- updated to 1.59
   see /usr/share/doc/packages/perl-DBD-Mock/Changes
  1.59 2021-02-22T13:25:52Z
      - Added error detection for when a result set's callback doesn't return
        an arrayref or arrayrefs
      - Moved to GitLab for issue tracking
Comments 0
openSUSE Build Service is sponsored by