THE Test::Cmd MODULE The Test::Cmd module provides a framework for portable automated testing of executable commands and scripts (in any language, not just Perl), especially commands and scripts that interace with the file system. In addition to running tests and evaluating conditions, the Test::Cmd module manages and cleans up one or more temporary workspace directories, and provides methods for creating files and directories in those workspace directories from in-line data (that is, here-documents), allowing tests to be completely self-contained. The Test::Cmd module inherits File::Spec methods (file_name_is_absolute(), catfile(), etc.) to support writing tests portably across a variety of operating and file systems. The Test::Cmd module may be used with the Test module to report test results for use with the Test::Harness module. Alternatively, the Test::Cmd module provides pass(), fail(), and no_result() methods that report test results for use with the Aegis change management system. It is not a good idea to intermix these two reporting models. INSTALLATION Installation is via the usual incantation: # perl Makefile.PL # make # make test # make install Let me know if you have any problems. RESOURCES A rudimentary page for the Test::Cmd module is available at: http://www.baldmt.com/Test-Cmd/ TO DO The documentation lists a To-Be-Written Test::Cmd::diff() method that would be an extremely handy addition. What I have in mind is to incorporate logic from Amir Karger's cdiff.pl front end to MJD's Algorithm::Diff module so that tests can generate diffs of actual and expected results without needing a diff program installed on the system. This is extra work to implement but makes the whole module as portable as possible to non-POSIX systems. The t/run.t test jumps through some complicated (but reasonably documented) hoops to generate an executable Perl script on Windows NT systems. I have no doubt that someone with a better knowledge of NT than mine could do this more simply, and would love to hear of a better solution than what I came up with. COPYRIGHT Copyright 1999-2000 Steven Knight. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. ACKNOWLEDGEMENTS Thanks to Greg Spencer for the inspiration to create this package and the initial draft of its implementation as a specific testing package for the Cons software construction utility. Information about Cons is available at: http://www.dsmit.com/cons/ The general idea of managing temporary working directories in this way, as well as the test reporting of the pass(), fail() and no_result() methods, come from the testing framework invented by Peter Miller for his Aegis project change supervisor. Aegis is an excellent bit of work which integrates creation and execution of regression tests into the software development process. Information about Aegis is available at: http://www.tip.net.au/~millerp/aegis.html AUTHOR Steven Knight, knight@baldmt.com