Testing database code in CPAN modules
- From: Joseph Brenner <doom@xxxxxxxxxxxxxxxxx>
- Date: Mon, 04 Apr 2005 11:33:33 -0700
I've written a module that I'm getting set to upload to CPAN,
but I'd like to write some decent tests for it first.
The module is probably going to be called "GraphViz::DBI::General" [1].
What the module does is let you automatically generate a graph of
table relationships given a DBI database handle. This poses a
few problems for testing, one of which is that the data to be
plotted is table relationships, not something simple like the
contents of a table. MockDBI and SQLite are probably out of the
question.
But what's the alternative? Check for the availability of a real
database (somehow), check that I've got the permissions to do
things like "CREATE DATABASE" (somehow), and do a full blown run?
Any suggestions?
[1] My "GraphViz::DBI::General" is a subclass of the existing
"GraphViz::DBI" which is intended to work with a wider range of
databases. In particular Postgresql, for which "GraphViz::DBI" is
pretty useless (it has no concept of schemas). Also the original
module relies on a naming convention to find foreign keys, and I
prefer the DBI method "foreign_key_info" (even if it is labeled
"experimental").
.
- Follow-Ups:
- Re: Testing database code in CPAN modules
- From: Ron Savage
- Re: Testing database code in CPAN modules
- Prev by Date: WIN32::API on .net
- Next by Date: Re: GD::Image: Can't locate object method "newFromJpeg"
- Previous by thread: WIN32::API on .net
- Next by thread: Re: Testing database code in CPAN modules
- Index(es):
Relevant Pages
|
|