I'd also add a small warning in that Apache::Test does seem to want to
dominate the entire test suite (run everything from TEST) and so may not
be as suitable in cases where you have 50-500 test scripts already, and
you just want a few to work with Apache::Test and a normal Makefile.PL
built with something like Module::Install.
So I've had to limit my use of it to specific cases where mod_perl
dominates the purpose of the entire distribution.
Unless you've fixed this since the tutorial :)
Because I really don't mind the cost of having to boot up TEST 4 times
for 4 scripts, when only 4 out of 100 need it.
Adam K
Geoffrey Young wrote:
Apache::Test looks like it might be the way to go. But it doesn't seem
to play very nicely with Test::More,
that's not really true. yes, Apache-Test was based on Test.pm (for various
reasons I won't get into here) but I added Test::More support and use it all
the time. grep for stuff like this in the docs
use Apache::Test qw(-withtestmore)
and comments like this in the
documentation:
Use Apache::TestMM in your Makefile.PL to set up your distribution
for testing.
give me the fear. I've already got my distribution set up, and it
doesn't use ExtUtils::MakeMaker...
yeah, unfortunately a Makefile.PL is really the simplest way to set A-T up.
you can also use Module::Build if you prefer.
without either of those options you kind of need to resort to a bit of
trickery. see, for example
http://www.modperlcookbook.org/~geoff/slides/OSCon/2005/OSCon-2005-code.tar.gz
and take a look at mod_example_ipc-install. it uses some gmake trickery so
that 'make' invokes 'perl Makefile.PL' and commands unrecognized by the
lowest-level makefile get passed to the generated Makefile. yeah, I know,
but it's the best I've been able to come up with for people who are afraid
of a Makefile.PL.
Am I setting myself up for pain, or is there a nice simple approach to
doing this that I've overlooked?
I use Apache-Test all the time - every day, in fact, for a very large
codebase with a very complex setup (way more complex than the makefile
trickery I just described). I pretty much hacked together a series of make
targets that pull in the various libraries I need, does the proper overlays,
etc. granted, it's for $dayjob, where the environment is considerably more
fixed than a distrobution would allow for.
but, outside of all that, you can pull a simple example of Apache-Test in
action here:
http://people.apache.org/~geoff/Apache-Test-skeleton-mp1.tar.gz
or
http://people.apache.org/~geoff/Apache-Test-skeleton-mp2.tar.gz
run
$ perl Makefile.PL -httpd /path/to/your/httpd
and see what the various test* targets and the resulting t/TEST file look
like - you could pretty much copy the t/TEST file figure out what features
of the make targets you want to keep. in reality, once the t/TEST file has
been generated it runs everything, so if you (or your userbase) is
intelligent enough having A-T in @INC and t/TEST should be all you need to
actually use Apache-Test.
HTH
--Geoff