I'm puzzled. I have a number of tests in a distribution. The test reside in the /t subdirectory. When I run those test from a command line, thusly:

prove t/*.t

All tests pass just fine. No errors of any kind are spit out. I'm still working on the tests and they all currently use Test::More with "no_plan". I also have Test::Pod and Test::Pod::Coverage tests.

I wrote a test harness - you'll find the code below my signature, if you're interested. When I run it, I get the following:

You said to run 0 tests!  You've got to run something.
# Looks like your test died before it could output anything.

Then the tests run and the success/failure report for each module returns success. Anyone have any idea where this error is coming from? I'm assuming it's Test::Harness, but I'm not sure what I'm doing wrong. I've done some Googling, but I've so far found nothing useful. I see others are getting that error but I'm not seeing it in the same context in which I'm getting it.

If it matters, I'm running ActiveState 5.8.7 on Windows XP.

Regards,

Troy Denkinger

--- included code ---
#!/usr/bin/perl

use strict;
use warnings;
use File::Find;
use Cwd;
use Text::Reform qw( form );
use Data::Dumper;
use Getopt::Long;
use Pod::Usage;

use Test::Harness::Straps;
my $strap = Test::Harness::Straps->new();

our( @status, @filename, @expected, @run, @passed, @skipped, @todo, @todo_skipped );
our( $opt_help, $opt_path, $opt_email, $opt_noprint );

GetOptions( "help|h"    => \$opt_help,
           "path|p=s"  => \$opt_path,
           "email|e=s" => \$opt_email,
           "noprint|n" => \$opt_noprint,
          );

pod2usage( -verbose => 2 ) if $opt_help;

my $path = getcwd unless $opt_path;

find( \&test_found, $path );

my $report_date = localtime( time );

my $alert = form
'',
"Test suite at $path",
"Report Date: $report_date",
'',
' ====================================================', ' Tests ', ' ====================================================', 'Status Filename Expected Run Passed Skipped TODO TODO Skipped',
'----------------------------------------------------------------------------------------------',
'|||| [[[[[[[[[[[[[[[[[[[[[[[[[[[[[[ ||| ||| ||| ||| ||| |||', [EMAIL PROTECTED], [EMAIL PROTECTED], [EMAIL PROTECTED], [EMAIL PROTECTED], [EMAIL PROTECTED], [EMAIL PROTECTED], [EMAIL PROTECTED], [EMAIL PROTECTED];


print $alert unless $opt_noprint;
send_mail( $alert, "Test Suite: $path", $opt_email ) if $opt_email;

sub send_mail{
   my ( $alert, $subject, $to_email ) = @_;
   # Send email here
}

sub test_found{
   return unless m/\.t$/;
   return if $File::Find::name =~ m/exclude_tests/i;

   my %results = $strap->analyze_file( $File::Find::name );

   my $status = 'FAIL';
$status = ' OK ' if $results{'max'} == $results{'seen'} && $results{'seen'} == $results{'ok'};

   my ( $file ) = $File::Find::name;
   $file =~ s/$path//;;

   push @status, $status;
   push @filename, $file;
   push @expected, $results{'max'};
   push @run, $results{'seen'};
   push @passed, $results{'ok'};
   push @skipped, $results{'skip'};
   push @todo, $results{'todo'};
   push @todo_skipped, $results{'bonus'};
}

1;

Reply via email to