http://www.perlmonks.org?node_id=424482


in reply to Testing a DBI module

Maybe DBD::Mock can help you. It does not connect to any real database, but just traces all the SQL you issue, so that you can later check if that is what you wanted.

Maybe you want to have a look at DBD::SQLite. While it does not exist everywhere, it is easy to install anywhere because it contains its own DBMS.

You could have some tests that only run if DBD::SQLite is present (using a temporary file for your test DB).

You can also have the user set the DBI connect string via an environment variable if he wants to run the tests against his real database. These tests will be skipped in automated testing, but at least they can run them after reading your README if they want.