Oh, then maybe the 'defer_plan' is actually what I wanted to do all along.
That might fit perfectly into my acceptance testing scenario tool. Since I
really don't know how many scenarios the "user" of the tool is going to
write, so I can't really specify a fixed amount of tests. But I DO want to
count his failed/success attempts in the scenarios ... and I DO want to
generally use a testing framework for it (currently I use Test::More).
The small example I made is at http://github.com/kesor/p5-cucumber



On Fri, Mar 13, 2009 at 3:13 PM, Ovid <publiustemp-perl...@yahoo.com> wrote:

> ________________________________
> From: Evgeny <evgeny.zis...@gmail.com>
>
> > I actually put a link to the FAQ at the very first mail I sent.
>
> Oh, that's embarrassing :)
>
> > It does not address my questions, it gives examples that say
> > "we can't count tests ahead of time, its impossible". But I
> > just want you to change the approach from "ahead of time" into
> > "realtime" or something ... like all the other testing
> > frameworks do it.
>
> I'm sorry, but I simply do not believe "all the other testing frameworks"
> do this.  That being said:
>
> There's a difference between behavior and intent:
>
>   can_ok $account, 'customers';
>   for my $customer ($account->customers) {
>       ok $customer->is_current, '... and it should only return current
> customers';
>   }
>
> How many tests is that?  Just because your tests all passed doesn't mean
> that it's the correct number of tests.  (What if that doesn't return all of
> the "current" customers?)
>
> Premature exits are also caught with plans.
>
> If you still want to calculate a plan on the fly:
>
>   use Test::More 'defer_plan';
>   # run tests
>   all_done($number_of_tests);
>
>
> Note that $number_of_tests is optional.
>
> Cheers,
> Ovid
> --
> Buy the book         - http://www.oreilly.com/catalog/perlhks/
> Tech blog            - 
> http://use.perl.org/~Ovid/journal/<http://use.perl.org/%7EOvid/journal/>
> Twitter              - http://twitter.com/OvidPerl
> Official Perl 6 Wiki - http://www.perlfoundation.org/perl6
>

Reply via email to