http://www.perlmonks.org?node_id=399663


in reply to Re^2: using Test::* modules for generic testing of non perl stuff?
in thread using Test::* modules for generic testing of non perl stuff?

I used the word "misuse" because I think that the Test::* modules were originally used for testing code, and I've adapted them to some orthogonal uses.

At it's most fundamental, you just need to define a set of "things" you want to test and define their acceptable output. This can be tricky, as you might need to define a range of acceptable output values. One strategy that I've used in the past is to predefine a hash like this:

%commands = { $cmd1 => $output1, ... };
Then execute the commands and test the dynamic output against the predefined output.

I've actually got to run and catch a plane, but I'll be sure to check on this thread when I get back. Cheers. :)

  • Comment on Re^3: using Test::* modules for generic testing of non perl stuff?
  • Download Code

Replies are listed 'Best First'.
Re^4: using Test::* modules for generic testing of non perl stuff?
by jfroebe (Parson) on Oct 15, 2004 at 21:21 UTC

    I understand where you're coming from now. I *think* the Test::* should work okay as long as I code a pass/fail. What I do like is the fact that the Test::* are already built and are relatively simple to use. I agree that depending on what I'm testing, I might have to shoehorn it.

    I guess I'm looking for reasons NOT to use it.. At this point, I see only that some extra coding of the test may only need to be done.. But since I've fallen for too good to be true with some perl modules on cpan before (fits my need but no maintainer, doesn't fit my need exactly but maintainer goes ballistic when I submit a patch extending it without getting permission first from the maintainer to modify the module in the first place for my own use, etc.), I'm skeptical

    Jason L. Froebe

    p.s. Hava a good flight! No delays!

    No one has seen what you have seen, and until that happens, we're all going to think that you're nuts. - Jack O'Neil, Stargate SG-1