Consider this test file:

#!perl use Test::More 0.96; subtest "subtest1" => sub { ok 1; ok 2; }; subtest "subtest2" => sub { ok 3; ok 4; ok 5; subtest "subtest3" => sub { ok 6; ok 7; }; }; done_testing;

If we run it:

% prove -lv t/sample.t 
t/sample.t .. 
    # Subtest: subtest1
    ok 1
    ok 2
    1..2
ok 1 - subtest1
    # Subtest: subtest2
    ok 1
    ok 2
    ok 3
        # Subtest: subtest3
        ok 1
        ok 2
        1..2
    ok 4 - subtest3
    1..4
ok 2 - subtest2
1..2
ok
All tests successful.
Files=1, Tests=2,  0 wallclock secs ( 0.02 usr  0.00 sys +  0.01 cusr  0.00 csys =  0.03 CPU)
Result: PASS

Is there a way to get the number of tests including those inside subtests? (in this case, 7, or 8 if we include the inner subtests, or 10 if we include all subtests). Since I group tests using subtests, I keep seeing a low number of tests (in this case, 2) even though I have added more and more tests.


In reply to Printing number of tests (including inside subtests) by Anonymous Monk

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.