use Test::More; sub weight (&$$) { my ($c_test, $name, $weight) = @_; my $res = subtest $name, $c_test; ok($res,$name) for 2.. $weight; } weight { is "a","a" } "PASSING" => 3; weight { is "a","X" } "FAILING" => 2; done_testing; #### # Subtest: PASSING ok 1 1..1 ok 1 - PASSING ok 2 - PASSING ok 3 - PASSING # Subtest: FAILING not ok 1 # Failed test at /home/lanx/perl/pm/test_metric.pl line 16. # got: 'a' # expected: 'X' 1..1 # Looks like you failed 1 test of 1. not ok 4 - FAILING # Failed test 'FAILING' # at /home/lanx/perl/pm/test_metric.pl line 6. not ok 5 - FAILING # Failed test 'FAILING' # at /home/lanx/perl/pm/test_metric.pl line 8. 1..5 # Looks like you failed 2 tests of 5. <--- Metric #### # test_metric.pl:33: [ # { actual_ok => 1, name => "PASSING", ok => 1, reason => "", type => "" }, # { actual_ok => 1, name => "PASSING", ok => 1, reason => "", type => "todo" }, # { actual_ok => 1, name => "PASSING", ok => 1, reason => "", type => "todo" }, # { actual_ok => 0, name => "FAILING", ok => 0, reason => "", type => "" }, # { actual_ok => 0, name => "FAILING", ok => 1, reason => "", type => "todo" }, # ]