[Pdx-pm] Modern testing in perl

Ovid publiustemp-pdxpm at yahoo.com
Sat Mar 6 10:00:51 PST 2010

----- Original Message ----
> From: Ben Prew <ben.prew at gmail.com>

> If you're considering re-imagining what unit testing looks like, I'm a
> fan of the spec format of testing (rspec (ruby), screwunit
> (javascript)), but I'd be happy to have any good xUnit-style testing
> framework for Perl, regardless of syntax/format.

For that, I humbly (ha!) recommend my Test::Class::Most.  Instead of:

    use strict;
    use warnings;
    use Test::Exception;
    use Test::Differences;
    use Test::Deep;
    use Test::Warn;
    use Test::More;

    use parent 'My::Test::Class'; 

You just write:

    use Test::Class::Most parent =>  'My::Test::Class';

And you're off and running for xUnit style tests. (Yes, you even get strict and warnings with it).

If you struggle with Test::Class -- many do since it needs better docs -- I wrote a five part tutorial for it:

    * http://www.modernperlbooks.com/mt/2009/03/organizing-test-suites-with-testclass.html
    * http://www.modernperlbooks.com/mt/2009/03/reusing-test-code-with-testclass.html
    * http://www.modernperlbooks.com/mt/2009/03/making-your-testing-life-easier.html
    * http://www.modernperlbooks.com/mt/2009/03/using-test-control-methods-with-testclass.html
    * http://www.modernperlbooks.com/mt/2009/03/working-with-testclass-test-suites.html

Buy the book - http://www.oreilly.com/catalog/perlhks/
Tech blog - http://use.perl.org/~Ovid/journal/
Twitter - http://twitter.com/OvidPerl
Official Perl 6 Wiki - http://www.perlfoundation.org/perl6

More information about the Pdx-pm-list mailing list