First things first:  prove -r or  prove -- recurse will chug through the directories looking for *.t files to run.

Second things second: what do you feel comfortable with? Do things you are comfortable with. There is, after all, More Than One Way....

I tend to use the format "tnn-short-memory-jogging-phrase.t", to name my test-files. (ie: t00-basic-api.t, t05-extended-api.t, etc) Each file consists of all of the tests for a single module. I select 'nn' to have common functions grouped together in the prove() output or a directory listing. This works for me until the test-file for a single module gets 'too large', either logically (more that three or four logical/functional groupings) or physically (20+ one-line tests). (I basically follow the same principal that I use in deciding whether some code needs to be broken up into sub-routines -- Do I have to scroll up and down more than half-a-screen? Split it up!) When a test file gets too large, then I build the sub-directory for the module, move the test-harness into it, and refactor into several (much smaller) tnn-aaa.t files.

This has worked reasonably well for me over the years, but it's really a matter of personal taste. Just set things up so that it is easy for you to keep track of things during the Development process.

Also, remember that the Maintenance Programmer has to be able to pick up your test-file philosophy with out too much difficulty later. Make it easy for Them, and They are much more likely to Bless Your Name when they have to fix bugs and make functional changes.

----
I Go Back to Sleep, Now.

OGB


In reply to Re: test files - organising by Old_Gray_Bear
in thread test files - organising by Cagao

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.