legLess has asked for the wisdom of the Perl Monks concerning the following question:
Monks ~
I'm packaging a mid-sized Perl application and have a question about tests. I have a comprehensive test suite (including WWW::Mechanize interface tests) but the application itself requires a MySQL database. Most of the tests require access to a live data source.
This is fine for local development, but I'm not sure how to handle it when I distribute the app. I'd have to skip most of the tests, somehow, since it wouldn't be possible to run them on install. Should I just run a skeleton suite of really basic tests? If I test before I package, I can be pretty sure that any data source which meets the requirements will work.
There's advice here (Writing tests for modules using database handles) to support other data sources, like DBD::CSV and DBD::RAM. This is a good idea, and I have on my list to support SQLite and Postgres. I don't want to hold up packaging and distributing this (early and often!) until I make support for more data sources, though.
Aside from the more theoretical question, I'm not sure how to implement it. All I can think of now is to pass a command-line argument into the tests which, if received, runs the data source tests. The default 'test' target in the Makefile wouldn't pass such an argument, so these tests would be skipped unless specifically requested. This seems like a nasty hack, and I'm eager for a better solution.
Thanks in advance for any advice.
legless
Edited by BazB: fixed link.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Packaging and testing a module which requires a database
by chromatic (Archbishop) on Feb 06, 2004 at 17:04 UTC | |
by legLess (Hermit) on Feb 06, 2004 at 17:57 UTC | |
Re: Packaging and testing a module which requires a database
by blokhead (Monsignor) on Feb 06, 2004 at 17:36 UTC | |
by legLess (Hermit) on Feb 06, 2004 at 18:00 UTC | |
Re: Packaging and testing a module which requires a database
by perrin (Chancellor) on Feb 06, 2004 at 18:43 UTC | |
Re: Packaging and testing a module which requires a database
by jZed (Prior) on Feb 06, 2004 at 23:19 UTC |