On Fri, Jun 25, 2004 at 11:10:19AM -0400, Andrew Pimlott wrote: > 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.
That depends on what you class as a "test" for this principle. A "test" (as in a test method) can contain lots of "tests" (as in Test::More function calls). There's no problem with having lots of 'asserts' in one test 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? erm, sub test_my_func : Test(no_plan) { my $self = shift; my @test_data = get_test_data_from_somewhere(); $self->num_tests(scalar @test_data); foreach (@test_data) { is(my_func($_->{input}), $_->{output}, $_->{test_name}); } } What am I missing? Tony