Come for the quick hacks, stay for the epiphanies. | |
PerlMonks |
Architecting a testing framework for an APIby mp (Deacon) |
on Mar 23, 2006 at 01:24 UTC ( [id://538638]=perlquestion: print w/replies, xml ) | Need Help?? |
mp has asked for the wisdom of the Perl Monks concerning the following question:
I'm writing a set of modules that will function as sort of a data access API (mostly reading/writing data in an sql database) that will be used by other (yet-to-be-written) modules that will be developed to add capability to a web application that runs under mod_perl.
I am trying to come up with a way to build a framework that will let developers code and unit test their yet-to-be-written modules to extend the web application without having to use the actual API code (except for integration testing) and without apache/mod_perl. I've written quite a few perl tests before and am familiar with and have used Test::MockObject, Test::MockModule, Test::More, etc., but thing I'm having a hard time trying to figure out is at a high level, how to structure this test framework in such a way that there's not a bunch of code duplication. I've used Test::Class a little, and maybe it is a good approach and I'm just not "getting it" enough yet. One approach I've thought of doing is to write mock versions of all the API libraries that provide some means for controlling the return values and that don't do any real database access. Then, the test code would 'use' these rather than the real API modules, but this doesn't really feel like the best approach because there are too many unknowns at this point. Are there any other good approaches to these sort of test frameworks? Any pointers to reading material or even what to search for on Google would be appreciated. I do have a copy of O'reilly's Perl Testing, which has been helpful.
Back to
Seekers of Perl Wisdom
|
|