water has asked for the wisdom of the Perl Monks concerning the following question:
Newbie testing question:
I'd like put some sql assertions in my test suite -- basically, query
should return zero rows, or N rows, or whatever. Not seeing anything thing in the Test:: family with this feature (did I miss something?), I planned to write my own Test::Sql module, extending Test::More, so I could writeselect blah from blah blah where blah blah blah
. The no_rows subroutine would grab the right DBI handle, query, retrieve rows, "OK" if no rows, and fail to displayu a rowcount and the first few rows returned if not zero rows.use strict; use Test::More tests=>19; use Test::Sql; ... ... no_rows(q(select blah from blah blah where blah blah blah)), 'correctl +y empty blah query')) ... ...
How do I extend Test::More so that the numbering still works? Do I emit my own "ok" or "nok", and how do I maintaining numbering? Is there a good test building faq somewhere I missed?
Many THanks
-water-
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Extending Test::More
by lachoy (Parson) on May 19, 2004 at 15:40 UTC | |
|
Re: Extending Test::More
by chromatic (Archbishop) on May 19, 2004 at 16:40 UTC | |
|
Re: Extending Test::More
by pg (Canon) on May 20, 2004 at 04:42 UTC |