I built a patch for a couple of modules and found myself having to go through and renumber all the testcases after the position I inserted my test.

Then that module has a pretty darn odd way of doing test cases. I've never had to explicitly number a test. There isn't even an API for explicit test numbers in Test::Builder!

More recently I tried to track down the source of a failure reported as "Hmmm. Looks like test 27 failed", or similar and found myself having to plod through the test file counting manually to work out which was test 27. Less than easy as the were a lot of tests commented out.
Either way, a line number of the failing testcase, and a traceback to the point of failure would be a lot more useful.

Good test descriptions help with this and any standard Test::Builder based module will report the line number of the failing test case.

#! /usr/bin/perl use strict; use warnings; use Test::More 'no_plan'; is 1+1, 2, 'addition works'; is 2*2, 5, 'oops - silly me'; __END__ # outputs ok 1 - addition works not ok 2 - oops - silly me # Failed test 'oops - silly me' # in foo.t at line 8. # got: '4' # expected: '5' 1..2

In reply to Re^13: Self Testing Modules by adrianh
in thread Self Testing Modules by Sheol

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.