We use Test::More all the time.

Every <module>.t we write has a corresponding t/<module>.t test file written for it.

I've included a real Makefile.PL from one of our projects, and a sample Test::More template .t file.

You should also read the ExtUtils::MakeMaker doco for more sophisticated ways of calling make test

# Makefile.PL use ExtUtils::MakeMaker; WriteMakefile( NAME => 'txu_bims', VERSION_FROM => 'VERSION.pm', test => {TESTS => './TXU/BIMS/t/*.t ./TXU/t/*.t' +}, # how to pass multiple test paths PMLIBDIRS => ['./TXU/BIMS', './TXU'], PREREQ_PM => { Log::Log4perl => 0.36, }, );
# template Module/Under/t/Test.t #!/usr/bin/perl -w use strict; use Test::More qw(no_plan); use Module::Under::Test; # test go here my $obj = Module::Under::Test->new(); isa_ok($obj, 'Module::Under::Test'); is($obj->method(), 'expected output', 'standard test'); is_deeply($obj->meth_retn_ref(), {complex => {structure => ['here']}}, + 'method returns ref to complex structure');

After this, its as simple as ...

perl Makefile.PL make test

More complex examples of calling make test are ...

*UPDATE* - proxy dropped out half way through uploading this - added the point list

+++++++++++++++++
#!/usr/bin/perl
use warnings;use strict;use brain;


In reply to Re: Re: Re: testing code by leriksen
in thread testing code by geekgrrl

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.