barries <[EMAIL PROTECTED]> writes:
> On Tue, Feb 20, 2001 at 10:38:43PM +0000, Piers Cawley wrote:
> <...neat expansion on do_all_tests() concept snipped...>
> 
> > Well, it's a thought anyway.
> 
> Seems pretty cool, but I'm trying to perceive the advantage over a pure
> sequential/functional.  I think I'm asking for an example where this
> adds significant benefit.

Well, it's Just Another Way To Do It that should not significantly
impact on those who want to carry on doing what they were doing. But
when I'm deep in objectland (which I often am on larger projects) then
the gear grinding that goes on when I start writing my tests in
procedural style can be a PITA. And if I'm doing test first design
then I want to be able to do:

lib/MyTests/SomeClass.pm:

sub set_up {
   my $self = shift;
   # Factor out common initialization code
   ...
}

sub test_new_behavior {
   my $self = shift;
   my $object = $self->{sample_object};
   $self->assert($object->do_new_behaviour);
   $self->assert($object->changed_in_expected_fashion);
   ...
}

(ie: Just hanging more test methods off my test classes as appropriate
and letting the wonders of OO dispatch and perl's introspection work
out what tests need to be run when I do a 'make test')

But that kind of approach is only really useful for the unit testing
side of things, when I want to do more acceptance testing type things
then I'll probably be writing more procedural code...

-- 
Piers

Reply via email to