Here is the t/ directory for one of my modules. Not everything in there is perfect (e.g. I should probably split 10_basic.t into multiple files someday), but it works. A few things to note:

How should I group my tests into the different .t files?

You actually have a lot of flexibility - the very basics are that prove and similar tools run the t/*.t files and expect Test Anything Protocol output, the only other thing to keep in mind is to set @INC appropriately, e.g. via prove -l. You can start with a single .t file, and as it grows, start splitting it up into multiple files. How you split it is up to you, but consider that while working on a specific part of the module, you may want to run only the tests for that part of the module. You can see by the various responses you've already got that this is a TIMTOWTDI issue :-)

How are the pros running individual test files quickly and efficiently with vim?

I run all my Perl from the command line, in the case of tests usually prove -l, as it gives me the closest environment to how my scripts will be executed later. Some IDEs do things with @INC, the working directory, or redirecting STDIN/OUT/ERR that I sometimes don't agree with, so I've found it easiest to simply have a terminal window open.


In reply to Re: How do you structure and run module test code? by haukex
in thread How do you structure and run module test code? by nysus

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.