I find this really useful, thanks. I'm using it as a consequence of the sitation I described in Reporting test failures within cron.
I noticed it doesn't work quite right if I run an incorrect number of tests. For example:
use Test::More tests => 3;
ok 1, 'Happy';
ok 1, 'Cheerful';
We expect three tests but only run two, which both succeed. Fortunately, is_expected deals with this, but unfortunately show_details doesn't report the failure. The altered is_expected_test_result below fixes this reporting problem:
sub is_expected_test_result {
my $test_result = shift;
return $test_result->{ok} &&
! is_unexpected_todo_success( $test_result ) &&
! diagnostics( $_ );
}
I discovered this when running some Test::WWW::Mechanize tests against a server that stops responding, causing later tests not to run.
|