httpd-test-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From William McKee <will...@knowmad.com>
Subject Re: Response Handlers (was Re: Perl test framework, TestConfig, and debugging A::T)
Date Sun, 18 Jan 2004 15:27:59 GMT
On Sat, Jan 17, 2004 at 02:35:17PM -0500, Geoffrey Young wrote:
> cool.  actually, I've been meaning for a while to create a :testmore import
> target that exports everything but ok() and plan() (the two that collide
> with Test::More). 

That'd be very useful!


> well, it's important if you're writing an API, not merely testing CGI
> scripts or the like.  for instance, suppose you have a class that subclasses
> mod_perl.  if you plan'd and ok'd things from a PerlHandler then you could
> do things like
> 
>   isa_ok($r, 'My::Class');
> 
> which you can't really do otherwise.

OK, let me see if I'm understanding. The response handler acts as a kind
of subclass that sits between modules in the project's lib/ directory
and requests. It's like a back-door into the code that is running on the
server which allows you to make your tests even more complete.

If this is correct, it's a very subtle distinction. The request test is
essentially testing the response. However, it doesn't have direct access
to the $r object that got created in response to the request--it just
gets the final data being sent back. In this sense, it seems like the
response test is like an Apache filter. If I'm grokking this correctly,
this seems like an amazingly powerful tool which would be useful to
testing an API but not as necessary for testing a web application unless
you're getting some hard-to-track bugs happening.

In Stas' example at perl.apache.org, he uses the url
'/TestApache__cool' in the request test, cool.t. I saw the paragraph at
the end of the section about developing response and request parts of a
test which described the directory layout. However, I didn't see a
discussion of how the url is created. I'm guessing that A::T takes all
the directories and files in t/response and creates Locations which
the test apache server can handle. Would the file
t/response/Mod/hot.pm create a url of '/Mod__hot'?


> I've always used environment variables.  for instance, when I was testing a
> SOAP client API, I defaulted my SOAP server to localhost, but used
> %ENV{SOAP_SERVER} (or somesuch) if available.  this let me run the same
> tests against both my local extra.conf.in and the production box I was
> setting up.

Coming from a DOS/Win* background (I've been using a Linux workstation
for about a year now), I'm not as familiar with the wide range of uses
for environment variables. It's good to know that others are using them
in this way. I'll continue to forge ahead.


> HTH

++


Regards,
William

-- 
Knowmad Services Inc.
http://www.knowmad.com

Mime
View raw message