I wrote a module that is a wrapper to a CLI for a web service. I've already written tests to cover the basic operation of the module for my specific environment where I know the CLI is installed and can see the exact output that can be expected from the CLI. I'm now in a position of thinking about what tests I need to ensure the module still works on versions of the CLI written on other systems and I'm trying to map out a general approach to these tests. I'd like to get some input from more seasoned monks on whether this makes sense and to avoid re-inventing the wheel.

First, I'm thinking if the CLI tool my module requires is not installed on a system or it is not up-to-date, I still want to install the module without failure (the user can always install or upgrade their CLI after installing my module) and skip the tests requiring the actual CLI. I plan on using some mocked up data to run the tests if it is not installed or if the CLI utility is not current. Alternatively, I could just abort the installation. I'm not sure what the best approach would be here and I'd greatly appreciate some thoughts on this.

But let's say I go with the first option and allow them to install my module without the CLI installed. When the user first fires up my module, I'm thinking I should prompt them to run the tests with the actual CLI installed. I'm thinking my module will check the status of a some kind of simple flag (maybe by the existence of file) and if it's not present, it will ask the user if they want to run the tests. After the tests run successfully, it'll set the flag to true and not prompt them again. But perhaps this is overkill? Maybe I should just ensure the output from the CLI is what is expected and abort any operation if it isn't what is expected?

TIA. I could have never gotten to this point without all the great monks here on PM!

$PM = "Perl Monk's";
$MCF = "Most Clueless Friar Abbot Bishop Pontiff Deacon Curate Priest";
$nysus = $PM . ' ' . $MCF;
Click here if you love Perl Monks


In reply to Post installation tests for a wrapper to a CLI utility? by nysus

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.