You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by clayton cottingham <dr...@smartt.com> on 2001/10/02 18:51:10 UTC

testing modules under apache

hiya

recently here at work 
ive been asked to start 
providing test scripts 
for my projects perl modules 

ive found that its kinda hard to 
figure out which way to testcertain paradigms

i was wondering what sort of help/tips/tricks
anyone out there in modperl land could help me with

here is the root of my problem
------------
i have one modules for my project called
*::Global

now this module contains any 
subs that can be reused by the rest of my project
as well as some constants and routines 
for calling in support tables relted to categories etc


i did a use case test script
on my *::ViewMember 
and it reches out for *::Global's
constant called *::Global::MEMBER_COLUMNS

now i usually load *::Global into the Apache startup.pl

so it is instanced under Apache

but of course in testing under the test harness this will fail!



=-=-=--=
ive noticed a couple of things that might help

one is Apache::FakeRequest

as well there is the way Apache::AuthCookie tests:
by starting up an httpd server inside of its test directory

id rather not do that as it could get messy fast

so if anyone could give me any tips at all ifd be most appreciative

thanks!

Re: testing modules under apache

Posted by Stas Bekman <st...@stason.org>.
clayton cottingham wrote:

[the gist of the clayton's request:
     The code needs to be tested under live httpd with mod_perl. How?
]

Apache-Test framework developed for mod_perl 2.0 is *exactly* what you 
want.

See how httpd-2.0 uses it (http://httpd.apache.org/test/ look for 'Perl 
Framework'). Grab the httpd-test sources (cvs from the above URL) and 
it's all there under perl-framework/.

The module was primary developed for 2.x but should work for 1.x as 
well. I think that the only requirement is perl 5.6.x.

I've started to write some basic guide for Apache-Test which you can 
find in the modperl-docs repository (currently only in .pod form):
src/devel/writing_tests/writing_tests.pod

You can grab the docs rep from 
http://cvs.apache.org/snapshots/modperl-docs/ (or via cvs)

Feel free to contribute back extensions for this doc...

_____________________________________________________________________
Stas Bekman             JAm_pH      --   Just Another mod_perl Hacker
http://stason.org/      mod_perl Guide   http://perl.apache.org/guide
mailto:stas@stason.org  http://ticketmaster.com http://apacheweek.com
http://singlesheaven.com http://perl.apache.org http://perlmonth.com/


Re: testing modules under apache

Posted by Erik Arneson <ea...@musiciansfriend.com>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 02 October 2001, clayton cottingham <dr...@smartt.com> wrote:
> recently here at work 
> ive been asked to start 
> providing test scripts 
> for my projects perl modules 
[ ... ]
> ive noticed a couple of things that might help
> 
> one is Apache::FakeRequest
> 
> as well there is the way Apache::AuthCookie tests:
> by starting up an httpd server inside of its test directory

Clayton,

We've got a huge testing suite here for our massive pile of mod_perl
stuff.  In order to get the mod_perl stuff tested, and to get a good
request object and everything, we set up a minimal Apache configuration
that would load just the modules we needed and respond to certain URIs,
then our test scripts use LWP to hit those URIs on our test Apache and
examine the output.

I know it sounds kind of tricky, but check out the way some mod_perl
does it's 'make test' stuff, and I think also the way HTML::Embperl goes
about things.  You'll see it isn't as complicated as it sounds, and
those examples probably do a lot more than you need.

- -- 
# Erik Arneson <ea...@musiciansfriend.com>   Web Engineer #
#  Mobile: 541.840.3100           GPG Key ID: 1024D/0A2C3C5E #
#  Office: 541.774.5391    <http://www.musiciansfriend.com/> #

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (GNU/Linux)
Comment: Processed by Mailcrypt 3.5.6

iD8DBQE7ufUq5M5feAosPF4RAq/pAKC/rgPL+VqJ7YdaaYAHuDKvA3Ue1QCeNAVY
oA68I/YNgERcUp2k7Wfj9oo=
=ccQV
-----END PGP SIGNATURE-----