Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??

Using HTTP::Recorder to help start building tests with WWW::Mech is smart. Using Test::WWW::Mech is better. But using Test::WWW::Mech inside of Apache::Test is really powerful.

Apache::Test, a subproject of the Apache HTTP Server Project, provides the framework for what web apps need. What do web apps need? Well, a configured web server.

Configuration to determine:

  • the location of the log files
  • the location of the htdocs
  • maybe the location of your perl modules
  • maybe you have specific configuration, I like my cgi-bin outside of my htdocs, so I often alias the cgi-bin dir.

You don't really care about those things when you're testing. You just want to think about the tests.

Apache::Test (A-T) takes care of all of that for you, you just provide the tests.

And A-T works great with CVS (and SVN). Sure you can use test suite build only on Test::WWW::Mech in cvs, but it's often inflexible - the tests are often in a different location that the web server. A-T essentially bundles the httpd.conf with your perl modules and your perl scripts and your tests. Everything you need is in one place. So with A-T you can just check out a copy of your code in a different sandbox and hack away. No need to tweak the httpd.conf files to point to a different location.

A-T, and test suites in general, make maintenance so much easier. Say you have a mod perl 1 app and want to move it to mod perl 2. If you have a test suite (either using A-T or not), you can run the test suite on it. But running the test suite on different version of perl and apache is really easy in A-T. I've seen A-T guru Geoffrey Young quickly and easily run a test suite on different combinations of version of Perl and Apache.

If you develop your web app with care you'll almost always have tests that test things outside of the web app. A-T can handle that for you to.

I'd say the biggest hurdle is setting up A-T, but you only do that once (per server configuration). And there are skeletons to help you do that.

A-T works with perl cgi scripts, Apache::Registry, mod perl and even php.

The docs are helpful - I'd like to help reorganize them but have done nothing at all to help yet.

Geoff, who is often helpful on the A-T mailing list wrote this article.


In reply to Re: Application Testing: Custom Module or Perl Test Files? by jimX11
in thread Application Testing: Custom Module or Perl Test Files? by ghenry

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others romping around the Monastery: (5)
As of 2024-03-29 09:00 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found