Stories
Slash Boxes
Comments
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
 Full
 Abbreviated
 Hidden
More | Login | Reply
Loading... please wait.
  • Test::Tutorial talks primarily about writing unit tests for modules. If you have existing scripts that you want to test, you may want to look into regression testing. Regression testing is used when releasing bug fixes and extensions to existing functionality to ensure that the overall level of functionality does not "regress" -- i.e. those things that worked in version 1.0 should keep working in version 1.1. I also find regression testing useful for poorly written legacy scripts. (For example, it is difficult to write unit tests that test the output of a function if the script doesn't make use of any functions....)

    There are two modules that you can use to automate regression testing for web-based functionality -- HTTP::Monkeywrench and HTTP::WebTest. (If you have mod_perl installed, you should also take a look at Apache::Recorder and HTTP::RecordedSession which make the process of generating configuration files for Monkeywrench and WebTest much simpler.) I have an article in progress for The Perl Review on regression testing if you're interested -- drop me a note (cbrooks at organiccodefarm dot com) if you'd like to take a look.
    • You mean The Perl Review [theperlreview.com], right? :-)

      I'm about to roll out some HTML testing stuff today or tomorrow that might be useful, too, along those lines. It'll be wrappers around HTML::Lint.

      Maybe we should put up sample code that shows how people use the testing stuff in the real world.

      --

      --
      xoa

    • # Here's a sample of a Session.t file that
      # corresponds to a Session.pm file I have.
      # It could certainly be more robust, and test
      # more options than just some simple scalars.

      #!/usr/bin/perl -w

      use strict;

      use constant SAVEPATH=>'/tmp';

      use Test::More tests=>7;

      BEGIN {
          use_ok( 'TW::Session' );
      }

      my $saved_session_id;

      CREATE: {
          my $session = new TW::Session( SavePath=>SAVEPATH );
          isa_ok( $session, 'TW::Session', 'Created first session' );
          $session-
      --

      --
      xoa