Are these modules only for testing perl code?
No, they are fairly general-purpose. Ignoring the internals, the simplest tests just do a boolean check (e.g. ok() from Test::More) and generate TAP output. You can and probably should use these modules to generate TAP output for you.
use Test::More;
ok connect_to_ftp(), "connect";
is get_something(), "expected string", "get_something";
is system("external command"), 0, "external command";
...
done_testing; # or use "plan tests => 123;" above
Here, connect_to_ftp() can do whatever you want, be it shelling out to some external command, calling a Java API, etc. - as long as it returns a true value on success and a false value on failure you can use it in ok() (even dieing is fine, since Test::More will report that as an error too). Same goes for get_something(), it can read from a socket, file, whatever. If you're going to be doing a lot of calling of external commands, I can highly recommend IPC::Run3 (one of the few modules that handles redirection of all three STDIN, STDOUT, and STDERR streams, and according to the test stats does it well).
Your idea to have a set of *.t files is a good one, this is how just about every module on CPAN with tests does it. Then, you can use the prove command and all the other tools that handle Perl and TAP tests. So you probably don't need a "master script" that executes your tests.
Although this is a design issue, personally I would limit your "test library" to be as small as necessary, since if you end up writing a big test library, you really should write tests for that, too. Instead, make your test cases as small and self-contained as possible (granted, that's not always possible).
(By the way, have you seen Inline::Java, maybe that's useful to you?) |