Better reporting for your test suite

It's very poorly documented, but Test::Class::Moose also has reporting built in.

Here's how diag() all test classes from slowest to fastest, with time information:

use Test::Most;
use Test::Class::Moose::Load 't/lib';    # assumes your T:C:M tests are here

my $test_suite = Test::Class::Moose->new;
$test_suite->runtests;

my $report = $test_suite->test_reporting;

# sort from slowest to fastest
my @classes =
  sort { $b->time->real <=> $a->time->real } $report->all_test_classes;
foreach my $class (@classes) {
    my $name = $class->name;
    my $duration = $class->time->duration; # a human-readable version
    diag "$name runtime: $duration";                                                                                                       
}

You can do that at a test method level, too. Plus, the time is broken down into system, user, and real time.

About Ovid

user-pic Freelance Perl/Testing/Agile consultant and trainer. See http://www.allaroundtheworld.fr/ for our services. If you have a problem with Perl, we will solve it for you. And don't forget to buy my book! http://www.amazon.com/Beginning-Perl-Curtis-Poe/dp/1118013840/