From Perl Testing: A Developer's Notebook by chromatic and Ian Langworth, page 40:
There's no technical reason to keep all of the tests for a
particular program or module in a single file, so create as
many test files as you need, organizing them by features,
bugs, modules, or any other criteria.
In my experience, this is sound advice.
Dividing a large number of tests into a number of smaller (cohesive) units,
is essentially just divide and conquer,
the only fundamental technique we have to fight complexity.
It also helps ensure that each test runs in isolation,
independent of others.
To give a specific example, notice that
written by Phalanx leader petdance,
contains 3 lib .pm files and 49 .t files.
Apart from all that, a single large .t file makes developing new tests
inconvenient because after adding a new test to the .t file,
you must run all the other tests (intolerable if the
single .t file contains stress tests taking hours to run).
Or are you recommending that we don't use
the standard Test::Harness/Test::More framework?
Are you posting in the right place? Check out Where do I post X? to know for sure.
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
Want more info? How to link or
or How to display code and escape characters
are good places to start.