Stories
Slash Boxes
Comments
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

jplindstrom (594)

jplindstrom
  (email not shown publicly)

Journal of jplindstrom (594)

Wednesday March 17, 2004
11:32 AM

Module of the day: Test::DatabaseRow

[ #17940 ]

We now use the promising-looking Test::DatabaseRow that I found in the comments in a previous journal entry.

It's very useful and perfectly solves the problem at hand -- whitebox testing the behind-the-scenes database stuff we previously only tested the API for.

It's a good thing because... well, the third test found a bug (yay us!).

Like I mentioned, I see the need for comparing the number of rows for a certain query before/after a test. I'll probably end up implementing something like that and see what kind of easy-to-use interface it should have.

Right now I think it's something like:


my $sql = "select * from blah where my_id = $id";

rows_added_ok($sql);
#do stuff that should add two rows
rows_added_ok($sql, 2, "Stuff() inserted into blah");
#do stuff that should add one more row
rows_added_ok($sql, 1, "Stuff() inserted into blah");

I imagine I should key the previous value to the "$dbh.$sql".

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
 Full
 Abbreviated
 Hidden
More | Login | Reply
Loading... please wait.