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.


In reply to Packaging and testing a module which requires a database by legLess

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.