[tpm] Follow-up on Feb 2012 Testing Talk

Rob Janes janes.rob at gmail.com
Sat Mar 3 07:13:23 PST 2012


i always do a useability test.  this is one of those cases where ok() does
not do the trick.

from Test::More man page:
     You usually want to test if the module you're testing loads ok, rather
than just vomiting if its load fails.
     For such purposes we have "use_ok" and "require_ok".

Note the modeline for emacs and vim.  test files normally end with .t, and
neither vim nor emacs automatically detect them as perl.

modelines can usually go in the first 5 or last 5 lines.

# -*- mode: perl -*-
# vim: set expandtab autoindent nows sts=2 sw=2:

use Test::More tests => 2;

## this tests the useability of the package

BEGIN {
  use_ok('Compress::Bzip2');
};

my $version = $Compress::Bzip2::VERSION;
ok( $version, "Compress::Bzip2 version is $version" );


On Fri, Mar 2, 2012 at 8:29 PM, James E Keenan <jkeen at verizon.net> wrote:

> So it turns out that the folks organizing the DC-Baltimore Perl Workshop
> () want their tutorial-type presentations to run in 50-minutes timeslots --
> not 20.  Which means I can actually add considerable material to the "82%
> of what you need" talk I gave last week.
>
> What else should I cover in a talk for those new to Perl testing?  I
> welcome your suggestions.
>
> (Below:  My own brainstorming.)
>
> * Introduce ok() at an even more basic level: use of Test::Simple::ok() in
> a program (as distinct from testing functions from a package).
>
> * Definitionally-oriented introductions of Test::Builder and Test::Harness.
>
> * Mention of other prominent Test::* classes (though I actually don't use
> them much because I already accomplish so much with Test::More).
>
> * Introduction of concept of coverage analysis.
>
> * Introduction of concept of test-driven development.
>
> * Illustration of use of 'make test' and './Build test'.
>
> Your thoughts?
>
> jimk
> ______________________________**_________________
> toronto-pm mailing list
> toronto-pm at pm.org
> http://mail.pm.org/mailman/**listinfo/toronto-pm<http://mail.pm.org/mailman/listinfo/toronto-pm>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.pm.org/pipermail/toronto-pm/attachments/20120303/54e073ab/attachment.html>


More information about the toronto-pm mailing list