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.
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |