----- Original Message ----
From: Adrian Howard <[EMAIL PROTECTED]>

On 3 Aug 2006, at 14:40, Michael Peters wrote:
[snip]
> > Actually, the way I use Test::Class is to have one script per  
> > class. That way I
> > can just run one if I want to.
>
> Yeah - but then you lose the start up time advantage when you run  
> multiple classes in the same process.
>
> (not that it's a bad idea - just that it has a down side ;-)

Interesting idea, but if every class has its own helper script, you have to 
remember to have those.  By having one driver script for Test::Class tests and 
having that driver script just figure out what the test classes are, you just 
write your class and don't worry about which other files you have to mention it 
in.  That's why I cringe when I see this in test scripts:

  use Test::Class;
  use Test::Foo;
  use Test::Foo::Bar;
  use Test::Quux::Baz;
  Test::Class->runtests;

That's needless duplication.  Keep all of your Test::Class tests in one 
directory and finding and running them is painless.

> If all your test classes inherit from a base class you could also do  
> something like:
>
> package MyBaseClass;
> use base qw( Test::Class );
> INIT { Test::Class->runtests }
>
> and just have them run automagically

Gah!  It always seems to be simpler than I imagined.

Cheers,
Ovid
 
-- If this message is a response to a question on a mailing list, please send 
follow up questions to the list.
 
Web Programming with Perl -- http://users.easystreet.com/ovid/cgi_course/




Reply via email to