Hi.

Newbie testing question:

I'd like put some sql assertions in my test suite -- basically, query

select blah from blah blah where blah blah blah
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 write
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')) ... ...
. 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.

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-


In reply to Extending Test::More by water

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.