On Fri, Jun 25, 2004 at 07:35:26AM +0100, Tony Bowden wrote:
> On Thu, Jun 24, 2004 at 07:13:08PM -0400, Andrew Pimlott wrote:
> > But (I thought) the idea was that every test needs the same setup. If
> > they're all in one method, they won't get that.
>
> How's that?
I thought the "isolation" principle that people were talking about is
that before every test, a "setup" method is called, and after every test
a "teardown" is called, automatically by the test harness. This
seems to require one method == one test.
> > Also, if you add lots of tests in a single method, (again as I understand)
> > they will stop after the first failure, which is not ideal if the rest of
> > the tests can still run.
>
> That's a feature. If they can still run, move them to a different
> method.
I was responding to your suggestion to put all the tests in one method
if they are just parametrized by data. How do you suggest writing the
equivalent of
foreach (@test_data) {
is(my_func($_->{input}), $_->{output}, $_->{test_name});
}
in xUnit style, such that the first failure does not cause the rest not
to run?
Andrew