| 1 |
THE Test::Cmd MODULE |
| 2 |
|
| 3 |
The Test::Cmd module provides a framework for portable automated testing |
| 4 |
of executable commands and scripts (in any language, not just Perl), |
| 5 |
especially commands and scripts that interace with the file system. |
| 6 |
|
| 7 |
In addition to running tests and evaluating conditions, the Test::Cmd |
| 8 |
module manages and cleans up one or more temporary workspace directories, |
| 9 |
and provides methods for creating files and directories in those workspace |
| 10 |
directories from in-line data (that is, here-documents), allowing tests |
| 11 |
to be completely self-contained. |
| 12 |
|
| 13 |
The Test::Cmd module inherits File::Spec methods (file_name_is_absolute(), |
| 14 |
catfile(), etc.) to support writing tests portably across a variety of |
| 15 |
operating and file systems. |
| 16 |
|
| 17 |
The Test::Cmd module may be used with the Test module to report test |
| 18 |
results for use with the Test::Harness module. Alternatively, the |
| 19 |
Test::Cmd module provides pass(), fail(), and no_result() methods that |
| 20 |
report test results for use with the Aegis change management system. |
| 21 |
It is not a good idea to intermix these two reporting models. |
| 22 |
|
| 23 |
|
| 24 |
|
| 25 |
INSTALLATION |
| 26 |
|
| 27 |
Installation is via the usual incantation: |
| 28 |
|
| 29 |
# perl Makefile.PL |
| 30 |
# make |
| 31 |
# make test |
| 32 |
# make install |
| 33 |
|
| 34 |
Let me know if you have any problems. |
| 35 |
|
| 36 |
|
| 37 |
|
| 38 |
RESOURCES |
| 39 |
|
| 40 |
A rudimentary page for the Test::Cmd module is available at: |
| 41 |
|
| 42 |
http://www.baldmt.com/Test-Cmd/ |
| 43 |
|
| 44 |
The most involved example of using the Test::Cmd package to test |
| 45 |
a real-world application is the "cons-test" testing suite for the |
| 46 |
Cons software construction utility. The suite sub-classes Test::Cmd |
| 47 |
to provide common, application-specific infrastructure across a |
| 48 |
large number of end-to-end application tests. The suite, and other |
| 49 |
information about Cons, is available at: |
| 50 |
|
| 51 |
http://www.dsmit.com/cons |
| 52 |
|
| 53 |
|
| 54 |
|
| 55 |
TO DO |
| 56 |
|
| 57 |
The t/run.t test jumps through some complicated (but reasonably |
| 58 |
documented) hoops to generate an executable Perl script on Windows |
| 59 |
NT systems. I have no doubt that someone with a better knowledge of NT |
| 60 |
than mine could do this more simply, and would love to hear of a better |
| 61 |
solution than what I came up with. |
| 62 |
|
| 63 |
Adding a timeout() method would provide better test automation for |
| 64 |
applications that run the risk of hanging. |
| 65 |
|
| 66 |
A feature to time tests would be good. |
| 67 |
|
| 68 |
|
| 69 |
|
| 70 |
COPYRIGHT |
| 71 |
|
| 72 |
Copyright 1999-2001 Steven Knight. All rights reserved. This program |
| 73 |
is free software; you can redistribute it and/or modify it under the |
| 74 |
same terms as Perl itself. |
| 75 |
|
| 76 |
|
| 77 |
|
| 78 |
ACKNOWLEDGEMENTS |
| 79 |
|
| 80 |
Thanks to Greg Spencer for the inspiration to create this package and |
| 81 |
the initial draft of its implementation as a specific testing package |
| 82 |
for the Cons software construction utility. Information about Cons |
| 83 |
is available at: |
| 84 |
|
| 85 |
http://www.dsmit.com/cons/ |
| 86 |
|
| 87 |
The general idea of managing temporary working directories in this way, |
| 88 |
as well as the test reporting of the pass(), fail() and no_result() |
| 89 |
methods, come from the testing framework invented by Peter Miller for |
| 90 |
his Aegis project change supervisor. Aegis is an excellent bit of work |
| 91 |
which integrates creation and execution of regression tests into the |
| 92 |
software development process. Information about Aegis is available at: |
| 93 |
|
| 94 |
http://aegis.sourceforge.net/ |
| 95 |
|
| 96 |
|
| 97 |
AUTHOR |
| 98 |
|
| 99 |
Steven Knight, [email protected] |