Has anyone seen, tried to implement, or otherwise played with TAP in shell? We're looking to create unit tests across many languages (don't get me started on why this doesn't exist so far), and since we have so much Perl code, we'll be looking at TAP (among others, I imagine). I've found a TAP library for C, Perl, of course, has it built-in, and I've even found an API for Java. But one area missing is shell script testing.
Not that I've found much on unit-testing shell scripts, either, but since we do have thousands of lines of shell code, it'd be nice to be able to test it somehow.
See the list of TAP Producers for a list of libraries. On that list you will find Tap-functions for shell code.
I usually write my own small test framework for my shell scripts. Some things to keep in mind when doing this:
diff(1)
is great to verify test results (and to display a useful error message to the user)That said, my "test framework" is mostly a set of shell functions (named test*
) and a runTests
function which calls them one by one. Nothing fancy, really. Tests create a work directory for the test, copy all necessary files into it, run a function, verify the results against a know-good set of files.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With