As a consequence, the number of tests is likely to explode,

On the other side, I feel like I'm cheating doing all these repetitive tests, and having lots of "ok..." where I should really have one,

It sounds like you've adopted a mindset that looks at the raw numbers at the end of the run, instead of looking at the actual testing.

Having a large number of tests doesn't mean anything.

There's no "cheating" if the number of tests goes up.

There's no sin in re-testing the same thing in multiple files. For example, there's nothing wrong, and indeed everything right, with checking the result of every single constructor call, as in

my $foo = Foo::Bar->new(); isa_ok( $foo, 'Foo::Bar' );
in every single file. For that matter, there's nothing wrong, and indeed everything right, with check the result for each line of text:
while ( my $line = <> ) { my $foo = Foo::Bar->parse( $line ); isa_ok( $foo, 'Foo::Bar' ); ... }
Don't worry about the test numbers. Keep throwing tests at it.

xoxo,
Andy


In reply to Re: Testing at the right granularity by petdance
in thread Testing at the right granularity by polettix

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.