Hi all,

Trying to speed up some tests at work.  We have a bunch of test files like this:

 t/foo/bar/baz.yml
 t/foo/bar/baz.t

So each .yml file has a corresponding .t file.  However, each .t file is (more 
or less) identical.  It looks like I can get the test time down from 10 minutes 
to about three by using one .t file which looks like this:

  use Test::More 'no_plan';
  foreach my $test ( find_tests() ) {
      runtests($test);
  }

That avoids the overhead of reloading perl and the modules multiple times.  
However, each .yml file defines its own test count and I don't want 'no_plan'.  
What I really want to do is this:

  use Test::More 'deferred_plan'
  my $plan = 0;

  foreach my $test ( find_tests() ) {

      $plan += runtest($test);  # returns count

  }
  plan $plan;


And if my plan doesn't match tests run, I get an error.

I could get around this by loading all of the YAML files and checking their 
count, but then I'd have to load them *again* when I run the tests and that 
defeats the purpose of speeding up the test suite.

Cheers,
Ovid 
--
Buy the book  - http://www.oreilly.com/catalog/perlhks/
Perl and CGI  - http://users.easystreet.com/ovid/cgi_course/
Personal blog - http://publius-ovidius.livejournal.com/
Tech blog     - http://use.perl.org/~Ovid/journal/

Reply via email to