I would say that your test script should test every possible outcome where that is feasible. It should test everything that can reasonably be tested, and particular emphasis should be given to checking the things that are obviously bound to happen do in fact happen.

If you are new to writing tests, this might sound like a nit-picking waste of time. Having spent some years qa testing code written by far more talented developers than myself, I think that it's definitely worth the extra effort. Just about any code a programmer thinks is ready for testing will (appear to) work fine in most common use cases, otherwise it wouldn't have been submitted. Obviously you should still test for this, but bugs are more likely to be unearthed in corner cases, or in situations where the program isn't doing what it looks like it's doing. (If that doesn't make sense to you, start writing some rigorous test scripts and it soon will).

If you have the resources, aim to have additional test scripts written by someone other than the author and based purely on the documented interface. This not only results in a test unbiased by the implementation, but will quickly improve the quality of your documentation.

You can also look at the test scripts for some large CPAN based distributions with multiple authors (one of the web frameworks, for example), to get an idea of the scope and depth of testing that is possible.


In reply to Re: Testing in Perl by Myrddin Wyllt
in thread Testing in Perl by mrguy123

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.