[tpm] testing; using eval to catch an error in a module
Madison Kelly
linux at alteeve.com
Sat Aug 29 12:20:22 PDT 2009
Michael Graham wrote:
>> I'm pretty sure I'm not doing it the "proper" way, but my Googling
>> hasn't yielded much yet. The most I've been able to gather so far is
>> that the "normal" way is to have a 't' directory and in there have a
>> 'test.pl' that 'make install' can call.
>
> Well, it is true that "make test" will indeed run your module's test
> suite. But honestly, that's not the main reason to do things The
> Right Way (tm) instead of the Hacky Handmade Way (tm).
>
> The advantages to doing standard Perl testing are:
>
> * your tests will be easier to write
>
> * your tests will be more concise
>
> * your tests will be more maintainable
>
> * your tests will make sense to other people
>
> * you can do more sophisticated testing more quickly (e.g. with
> Test::Deep, Test::MockObject, etc.)
>
> * you can get Test coverage with Devel::Cover
>
> * you can make a web-based dashboard of your test results by
> running your tests automatically on an hourly schedule and
> importing them into Smolder.
>
> Imagine setting off alarm bells right after you break
> your code, instead of discovering the problem three weeks later
> when you finally decide to run your test suite again!
>
> To get started, check out the following docs:
>
> Test::Tutorial:
> http://search.cpan.org/~rgarcia/perl-5.10.0/lib/Test/Tutorial.pod
>
> prove
> http://search.cpan.org/~andya/Test-Harness-3.17/bin/prove
>
> Test::More:
> http://search.cpan.org/~mschwern/Test-Simple-0.92/lib/Test/More.pm
>
>
>
>
> Michael
Thanks Michael!
I've been reading Test::More since you sent your first email. I'll
read up on those links, too.
I figured I was starting to re-invent the wheel, which is why I
asked. I knew there had to be a better/existing way to do this. Thanks
for pointing me in the right direction!
Madi
More information about the toronto-pm
mailing list