I'm refactoring a bunch of code that needs to determine currently available network interfaces and will be using IO::Interface to do the heavy lifting.

As part of the refactor I'm writing tests to ensure that interfaces for the system under test are detected correctly. These are obviously system-dependent.

The test suite for IO::Interface simply looks for a local loopback. What I'd like to do is somehow feed my test suite a list of expected interfaces, along with IP, broadcast, ether address, etc for each one.

Specifically, what would be the best practice for this? Seems my options are:

  1. Have the tester write the info to a file which the test script can read and parse (which opens up a whole 'nuther can of wirms).
  2. Have the tester pass the info to the test script. Again, parsing the info will be an issue.
  3. Have the test script bypass my code and use IO::Interface directly to establish the interfaces, and compare these with the output from my module's methods.
  4. Have the test script query the user at test-time. Again, parsing input, and also not very automatic.
  5. Something Else.

Seems options 1,2, and 4 are all variants of the same thing and have too many issues to be useful. Mainly, automated testing would be broken for most systems. Unless "Something Else" involves some magic of which I am unaware, then, the best course of action would be the third option. Of course, if I weren't using IO::Interface I would have to establish another solution.

So much for this specific problem, then, but it raises the general question of how to specify system-dependent information to test scripts in an automated way.

I've super-searched and googled but results were unsatisfactory, although that's probably the fault of my search terms rather than because no-one has encountered this issue before.

In the past I've managed to avoid this question by running manually all tests for which I have responsibility, and I'm therefore able to control the environment. As part of a more outward-thinking software development effort though I'd be interested to learn of any approach I may be missing. I'm sure this question must come up regularly so if there's an obvious approach I'm missing, feel free to smack me.


In reply to IO::Interface and System-dependent Testing by moot

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.