Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

In my work developing web apps I frequently need to create many "fake" entries in a database in order to test the functionality of the application. Does anyone know of an automated way to create these entries? I know that I can write a customized script easily enough, but I'm wondering if there is a module or script that already does this.

Replies are listed 'Best First'.
Re: Filling test database
by Mr_Person (Hermit) on Aug 24, 2004 at 21:41 UTC
    This doesn't directly answer your question, but you may want to take a look at DBD::Mock. stvn recently posted a meditation on it and it looks quite good. It won't automate the creation of test data, but it will integrate nicely into your test scripts and doesn't require the modification of an actual database.
Re: Filling test database
by cyocum (Curate) on Aug 24, 2004 at 20:05 UTC

    I knew there was an O'Reilly article on this subject somewhere. It is a java project but it might have some relevance for you in your search or it might give you some ideas for a Perl version. I hope this helps.

Re: Filling test database
by Velaki (Chaplain) on Aug 24, 2004 at 19:32 UTC

    Best I can think of off the top o' me head is to write a perl program to generate the test data and insert via DBI, or generate the test data with perl, save it in a text file, and bulk load it into the RDBMS. (ymmv)

    I've done both, depending on the database, how much was going to change, and whether or not I could simply refresh the data, or had to drop and recreate large pieces of the schema.

    As for which modules are out there, probably the DBI and DBIx modules could help speed things up for the first solution.

    Hope that helps.

    -v
    "Perl. There is no substitute."
Re: Filling test database
by dragonchild (Archbishop) on Aug 24, 2004 at 19:35 UTC
    Nope. Every one of these needs to be a customized script, because each of these needs to be customized to a given testing plan.

    ------
    We are the carpenters and bricklayers of the Information Age.

    Then there are Damian modules.... *sigh* ... that's not about being less-lazy -- that's about being on some really good drugs -- you know, there is no spoon. - flyingmoose

    I shouldn't have to say this, but any code, unless otherwise stated, is untested

Re: Filling test database
by Your Mother (Archbishop) on Aug 25, 2004 at 00:59 UTC

    You could give this a try: Data::Random. I used it a little for generating some phony gallies for yet another module I didn't round out enough for the CPAN. I ended up with my own fake data generator b/c I needed it to be more HTML and paragraph oriented. But that module does lots of nice fake data that should be easy to stuff into INSERTs.