Charles Engelke's Blog

July 10, 2003

OSCON Day 4: Session – Writing Tests with Apache::Test

Filed under: Ozette Brown — Charles Engelke @ 2:02 pm

Uses test.pm and is a perl based framework.

Why test?

  • development is faster and easier
  • code is more robust
  • code is more maintainable
  • code is exponentially more valuable
  • everyone else is doing it

    Why Apache-Test?

  • next cool thing
    – bundled with mod_perl 2.0

  • works with mod_perl 1.0
    – works with any apache installation
    – mod_perl
    _ mod_php

    What Apache-Test Is?

  • framework for testing apache-based application components
    – unit test

  • gives you a self-contained, pristine environment for testing
  • provides HTTP-centric testing tools

    What apache-test is not?

  • front to back testing engine
  • not designed fro testing a series of pages

    Testing, Testing…1,2,3
    1. Generate the test harness
    – generally starts from Makefile.PL
    – but don’t get bogged down with Makefile.PL
    2. configure apache
    – apache needs a basic configuration to service requests
    – contenst is needed
    – Apache-Test provides server defaults
    3. write the tests
    Apahce::Test

  • provides basic test.pm functions
    – ok()
    – plan()

  • also provides helpful plan() functions
    – have_lwp()
    – have_module()

    Apache::TestRequest

  • provides a basic LWP interface

    4. Run the tests

    It’s not just for mod_perl

  • Apache-Test is generic enough to test any Apache-centric environment

    Where is Apache-Test?

  • mod_perl 2.0
  • CPAN
  • http://www.perl.com/pub/a/2003/5/22/testing.html
  • http://perl.apache.org/docs/general/testing/testing.html
  • Apache-Test manpages
  • mod_perl Developers Cookbook
  • all the test in the perl-framework part of the httpd-test project
  • The slides

    That’s it, on to the next session. O-

    Advertisement
  • Blog at WordPress.com.

    %d bloggers like this: