| 1 | .\" Automatically generated by Pod::Man v1.34, Pod::Parser v1.13 |
| 2 | .\" |
| 3 | .\" Standard preamble: |
| 4 | .\" ======================================================================== |
| 5 | .de Sh \" Subsection heading |
| 6 | .br |
| 7 | .if t .Sp |
| 8 | .ne 5 |
| 9 | .PP |
| 10 | \fB\\$1\fR |
| 11 | .PP |
| 12 | .. |
| 13 | .de Sp \" Vertical space (when we can't use .PP) |
| 14 | .if t .sp .5v |
| 15 | .if n .sp |
| 16 | .. |
| 17 | .de Vb \" Begin verbatim text |
| 18 | .ft CW |
| 19 | .nf |
| 20 | .ne \\$1 |
| 21 | .. |
| 22 | .de Ve \" End verbatim text |
| 23 | .ft R |
| 24 | .fi |
| 25 | .. |
| 26 | .\" Set up some character translations and predefined strings. \*(-- will |
| 27 | .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left |
| 28 | .\" double quote, and \*(R" will give a right double quote. | will give a |
| 29 | .\" real vertical bar. \*(C+ will give a nicer C++. Capital omega is used to |
| 30 | .\" do unbreakable dashes and therefore won't be available. \*(C` and \*(C' |
| 31 | .\" expand to `' in nroff, nothing in troff, for use with C<>. |
| 32 | .tr \(*W-|\(bv\*(Tr |
| 33 | .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' |
| 34 | .ie n \{\ |
| 35 | . ds -- \(*W- |
| 36 | . ds PI pi |
| 37 | . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch |
| 38 | . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch |
| 39 | . ds L" "" |
| 40 | . ds R" "" |
| 41 | . ds C` "" |
| 42 | . ds C' "" |
| 43 | 'br\} |
| 44 | .el\{\ |
| 45 | . ds -- \|\(em\| |
| 46 | . ds PI \(*p |
| 47 | . ds L" `` |
| 48 | . ds R" '' |
| 49 | 'br\} |
| 50 | .\" |
| 51 | .\" If the F register is turned on, we'll generate index entries on stderr for |
| 52 | .\" titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and index |
| 53 | .\" entries marked with X<> in POD. Of course, you'll have to process the |
| 54 | .\" output yourself in some meaningful fashion. |
| 55 | .if \nF \{\ |
| 56 | . de IX |
| 57 | . tm Index:\\$1\t\\n%\t"\\$2" |
| 58 | .. |
| 59 | . nr % 0 |
| 60 | . rr F |
| 61 | .\} |
| 62 | .\" |
| 63 | .\" For nroff, turn off justification. Always turn off hyphenation; it makes |
| 64 | .\" way too many mistakes in technical documents. |
| 65 | .hy 0 |
| 66 | .if n .na |
| 67 | .\" |
| 68 | .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2). |
| 69 | .\" Fear. Run. Save yourself. No user-serviceable parts. |
| 70 | . \" fudge factors for nroff and troff |
| 71 | .if n \{\ |
| 72 | . ds #H 0 |
| 73 | . ds #V .8m |
| 74 | . ds #F .3m |
| 75 | . ds #[ \f1 |
| 76 | . ds #] \fP |
| 77 | .\} |
| 78 | .if t \{\ |
| 79 | . ds #H ((1u-(\\\\n(.fu%2u))*.13m) |
| 80 | . ds #V .6m |
| 81 | . ds #F 0 |
| 82 | . ds #[ \& |
| 83 | . ds #] \& |
| 84 | .\} |
| 85 | . \" simple accents for nroff and troff |
| 86 | .if n \{\ |
| 87 | . ds ' \& |
| 88 | . ds ` \& |
| 89 | . ds ^ \& |
| 90 | . ds , \& |
| 91 | . ds ~ ~ |
| 92 | . ds / |
| 93 | .\} |
| 94 | .if t \{\ |
| 95 | . ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u" |
| 96 | . ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u' |
| 97 | . ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u' |
| 98 | . ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u' |
| 99 | . ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u' |
| 100 | . ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u' |
| 101 | .\} |
| 102 | . \" troff and (daisy-wheel) nroff accents |
| 103 | .ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V' |
| 104 | .ds 8 \h'\*(#H'\(*b\h'-\*(#H' |
| 105 | .ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#] |
| 106 | .ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H' |
| 107 | .ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u' |
| 108 | .ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#] |
| 109 | .ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#] |
| 110 | .ds ae a\h'-(\w'a'u*4/10)'e |
| 111 | .ds Ae A\h'-(\w'A'u*4/10)'E |
| 112 | . \" corrections for vroff |
| 113 | .if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u' |
| 114 | .if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u' |
| 115 | . \" for low resolution devices (crt and lpr) |
| 116 | .if \n(.H>23 .if \n(.V>19 \ |
| 117 | \{\ |
| 118 | . ds : e |
| 119 | . ds 8 ss |
| 120 | . ds o a |
| 121 | . ds d- d\h'-1'\(ga |
| 122 | . ds D- D\h'-1'\(hy |
| 123 | . ds th \o'bp' |
| 124 | . ds Th \o'LP' |
| 125 | . ds ae ae |
| 126 | . ds Ae AE |
| 127 | .\} |
| 128 | .rm #[ #] #H #V #F C |
| 129 | .\" ======================================================================== |
| 130 | .\" |
| 131 | .IX Title "Test::Harness 3" |
| 132 | .TH Test::Harness 3 "2002-06-01" "perl v5.8.0" "Perl Programmers Reference Guide" |
| 133 | .SH "NAME" |
| 134 | Test::Harness \- run perl standard test scripts with statistics |
| 135 | .SH "SYNOPSIS" |
| 136 | .IX Header "SYNOPSIS" |
| 137 | .Vb 1 |
| 138 | \& use Test::Harness; |
| 139 | .Ve |
| 140 | .PP |
| 141 | .Vb 1 |
| 142 | \& runtests(@test_files); |
| 143 | .Ve |
| 144 | .SH "DESCRIPTION" |
| 145 | .IX Header "DESCRIPTION" |
| 146 | \&\fB\s-1STOP\s0!\fR If all you want to do is write a test script, consider using |
| 147 | Test::Simple. Otherwise, read on. |
| 148 | .PP |
| 149 | (By using the Test module, you can write test scripts without |
| 150 | knowing the exact output this module expects. However, if you need to |
| 151 | know the specifics, read on!) |
| 152 | .PP |
| 153 | Perl test scripts print to standard output \f(CW"ok N"\fR for each single |
| 154 | test, where \f(CW\*(C`N\*(C'\fR is an increasing sequence of integers. The first line |
| 155 | output by a standard test script is \f(CW"1..M"\fR with \f(CW\*(C`M\*(C'\fR being the |
| 156 | number of tests that should be run within the test |
| 157 | script. Test::Harness::runtests(@tests) runs all the testscripts |
| 158 | named as arguments and checks standard output for the expected |
| 159 | \&\f(CW"ok N"\fR strings. |
| 160 | .PP |
| 161 | After all tests have been performed, \fIruntests()\fR prints some |
| 162 | performance statistics that are computed by the Benchmark module. |
| 163 | .Sh "The test script output" |
| 164 | .IX Subsection "The test script output" |
| 165 | The following explains how Test::Harness interprets the output of your |
| 166 | test program. |
| 167 | .IP "\fB'1..M'\fR" 4 |
| 168 | .IX Item "'1..M'" |
| 169 | This header tells how many tests there will be. For example, \f(CW1..10\fR |
| 170 | means you plan on running 10 tests. This is a safeguard in case your |
| 171 | test dies quietly in the middle of its run. |
| 172 | .Sp |
| 173 | It should be the first non-comment line output by your test program. |
| 174 | .Sp |
| 175 | In certain instances, you may not know how many tests you will |
| 176 | ultimately be running. In this case, it is permitted for the 1..M |
| 177 | header to appear as the \fBlast\fR line output by your test (again, it |
| 178 | can be followed by further comments). |
| 179 | .Sp |
| 180 | Under \fBno\fR circumstances should 1..M appear in the middle of your |
| 181 | output or more than once. |
| 182 | .IP "\fB'ok', 'not ok'. Ok?\fR" 4 |
| 183 | .IX Item "'ok', 'not ok'. Ok?" |
| 184 | Any output from the testscript to standard error is ignored and |
| 185 | bypassed, thus will be seen by the user. Lines written to standard |
| 186 | output containing \f(CW\*(C`/^(not\es+)?ok\eb/\*(C'\fR are interpreted as feedback for |
| 187 | \&\fIruntests()\fR. All other lines are discarded. |
| 188 | .Sp |
| 189 | \&\f(CW\*(C`/^not ok/\*(C'\fR indicates a failed test. \f(CW\*(C`/^ok/\*(C'\fR is a successful test. |
| 190 | .IP "\fBtest numbers\fR" 4 |
| 191 | .IX Item "test numbers" |
| 192 | Perl normally expects the 'ok' or 'not ok' to be followed by a test |
| 193 | number. It is tolerated if the test numbers after 'ok' are |
| 194 | omitted. In this case Test::Harness maintains temporarily its own |
| 195 | counter until the script supplies test numbers again. So the following |
| 196 | test script |
| 197 | .Sp |
| 198 | .Vb 8 |
| 199 | \& print <<END; |
| 200 | \& 1..6 |
| 201 | \& not ok |
| 202 | \& ok |
| 203 | \& not ok |
| 204 | \& ok |
| 205 | \& ok |
| 206 | \& END |
| 207 | .Ve |
| 208 | .Sp |
| 209 | will generate |
| 210 | .Sp |
| 211 | .Vb 2 |
| 212 | \& FAILED tests 1, 3, 6 |
| 213 | \& Failed 3/6 tests, 50.00% okay |
| 214 | .Ve |
| 215 | .IP "\fBtest names\fR" 4 |
| 216 | .IX Item "test names" |
| 217 | Anything after the test number but before the # is considered to be |
| 218 | the name of the test. |
| 219 | .Sp |
| 220 | .Vb 1 |
| 221 | \& ok 42 this is the name of the test |
| 222 | .Ve |
| 223 | .Sp |
| 224 | Currently, Test::Harness does nothing with this information. |
| 225 | .IP "\fBSkipping tests\fR" 4 |
| 226 | .IX Item "Skipping tests" |
| 227 | If the standard output line contains the substring \f(CW\*(C` # Skip\*(C'\fR (with |
| 228 | variations in spacing and case) after \f(CW\*(C`ok\*(C'\fR or \f(CW\*(C`ok NUMBER\*(C'\fR, it is |
| 229 | counted as a skipped test. If the whole testscript succeeds, the |
| 230 | count of skipped tests is included in the generated output. |
| 231 | \&\f(CW\*(C`Test::Harness\*(C'\fR reports the text after \f(CW\*(C` # Skip\eS*\es+\*(C'\fR as a reason |
| 232 | for skipping. |
| 233 | .Sp |
| 234 | .Vb 1 |
| 235 | \& ok 23 # skip Insufficient flogiston pressure. |
| 236 | .Ve |
| 237 | .Sp |
| 238 | Similarly, one can include a similar explanation in a \f(CW1..0\fR line |
| 239 | emitted if the test script is skipped completely: |
| 240 | .Sp |
| 241 | .Vb 1 |
| 242 | \& 1..0 # Skipped: no leverage found |
| 243 | .Ve |
| 244 | .IP "\fBTodo tests\fR" 4 |
| 245 | .IX Item "Todo tests" |
| 246 | If the standard output line contains the substring \f(CW\*(C` # TODO\*(C'\fR after |
| 247 | \&\f(CW\*(C`not ok\*(C'\fR or \f(CW\*(C`not ok NUMBER\*(C'\fR, it is counted as a todo test. The text |
| 248 | afterwards is the thing that has to be done before this test will |
| 249 | succeed. |
| 250 | .Sp |
| 251 | .Vb 1 |
| 252 | \& not ok 13 # TODO harness the power of the atom |
| 253 | .Ve |
| 254 | .Sp |
| 255 | These tests represent a feature to be implemented or a bug to be fixed |
| 256 | and act as something of an executable \*(L"thing to do\*(R" list. They are |
| 257 | \&\fBnot\fR expected to succeed. Should a todo test begin succeeding, |
| 258 | Test::Harness will report it as a bonus. This indicates that whatever |
| 259 | you were supposed to do has been done and you should promote this to a |
| 260 | normal test. |
| 261 | .IP "\fBBail out!\fR" 4 |
| 262 | .IX Item "Bail out!" |
| 263 | As an emergency measure, a test script can decide that further tests |
| 264 | are useless (e.g. missing dependencies) and testing should stop |
| 265 | immediately. In that case the test script prints the magic words |
| 266 | .Sp |
| 267 | .Vb 1 |
| 268 | \& Bail out! |
| 269 | .Ve |
| 270 | .Sp |
| 271 | to standard output. Any message after these words will be displayed by |
| 272 | \&\f(CW\*(C`Test::Harness\*(C'\fR as the reason why testing is stopped. |
| 273 | .IP "\fBComments\fR" 4 |
| 274 | .IX Item "Comments" |
| 275 | Additional comments may be put into the testing output on their own |
| 276 | lines. Comment lines should begin with a '#', Test::Harness will |
| 277 | ignore them. |
| 278 | .Sp |
| 279 | .Vb 4 |
| 280 | \& ok 1 |
| 281 | \& # Life is good, the sun is shining, RAM is cheap. |
| 282 | \& not ok 2 |
| 283 | \& # got 'Bush' expected 'Gore' |
| 284 | .Ve |
| 285 | .IP "\fBAnything else\fR" 4 |
| 286 | .IX Item "Anything else" |
| 287 | Any other output Test::Harness sees it will silently ignore \fB\s-1BUT\s0 \s-1WE\s0 |
| 288 | \&\s-1PLAN\s0 \s-1TO\s0 \s-1CHANGE\s0 \s-1THIS\s0!\fR If you wish to place additional output in your |
| 289 | test script, please use a comment. |
| 290 | .Sh "Taint mode" |
| 291 | .IX Subsection "Taint mode" |
| 292 | Test::Harness will honor the \f(CW\*(C`\-T\*(C'\fR in the #! line on your test files. So |
| 293 | if you begin a test with: |
| 294 | .PP |
| 295 | .Vb 1 |
| 296 | \& #!perl -T |
| 297 | .Ve |
| 298 | .PP |
| 299 | the test will be run with taint mode on. |
| 300 | .Sh "Configuration variables." |
| 301 | .IX Subsection "Configuration variables." |
| 302 | These variables can be used to configure the behavior of |
| 303 | Test::Harness. They are exported on request. |
| 304 | .IP "\fB$Test::Harness::verbose\fR" 4 |
| 305 | .IX Item "$Test::Harness::verbose" |
| 306 | The global variable \f(CW$Test::Harness::verbose\fR is exportable and can be |
| 307 | used to let \fIruntests()\fR display the standard output of the script |
| 308 | without altering the behavior otherwise. |
| 309 | .IP "\fB$Test::Harness::switches\fR" 4 |
| 310 | .IX Item "$Test::Harness::switches" |
| 311 | The global variable \f(CW$Test::Harness::switches\fR is exportable and can be |
| 312 | used to set perl command line options used for running the test |
| 313 | script(s). The default value is \f(CW\*(C`\-w\*(C'\fR. |
| 314 | .Sh "Failure" |
| 315 | .IX Subsection "Failure" |
| 316 | It will happen, your tests will fail. After you mop up your ego, you |
| 317 | can begin examining the summary report: |
| 318 | .PP |
| 319 | .Vb 12 |
| 320 | \& t/base..............ok |
| 321 | \& t/nonumbers.........ok |
| 322 | \& t/ok................ok |
| 323 | \& t/test-harness......ok |
| 324 | \& t/waterloo..........dubious |
| 325 | \& Test returned status 3 (wstat 768, 0x300) |
| 326 | \& DIED. FAILED tests 1, 3, 5, 7, 9, 11, 13, 15, 17, 19 |
| 327 | \& Failed 10/20 tests, 50.00% okay |
| 328 | \& Failed Test Stat Wstat Total Fail Failed List of Failed |
| 329 | \& ----------------------------------------------------------------------- |
| 330 | \& t/waterloo.t 3 768 20 10 50.00% 1 3 5 7 9 11 13 15 17 19 |
| 331 | \& Failed 1/5 test scripts, 80.00% okay. 10/44 subtests failed, 77.27% okay. |
| 332 | .Ve |
| 333 | .PP |
| 334 | Everything passed but t/waterloo.t. It failed 10 of 20 tests and |
| 335 | exited with non-zero status indicating something dubious happened. |
| 336 | .PP |
| 337 | The columns in the summary report mean: |
| 338 | .IP "\fBFailed Test\fR" 4 |
| 339 | .IX Item "Failed Test" |
| 340 | The test file which failed. |
| 341 | .IP "\fBStat\fR" 4 |
| 342 | .IX Item "Stat" |
| 343 | If the test exited with non\-zero, this is its exit status. |
| 344 | .IP "\fBWstat\fR" 4 |
| 345 | .IX Item "Wstat" |
| 346 | The wait status of the test \fIumm, I need a better explanation here\fR. |
| 347 | .IP "\fBTotal\fR" 4 |
| 348 | .IX Item "Total" |
| 349 | Total number of tests expected to run. |
| 350 | .IP "\fBFail\fR" 4 |
| 351 | .IX Item "Fail" |
| 352 | Number which failed, either from \*(L"not ok\*(R" or because they never ran. |
| 353 | .IP "\fBFailed\fR" 4 |
| 354 | .IX Item "Failed" |
| 355 | Percentage of the total tests which failed. |
| 356 | .IP "\fBList of Failed\fR" 4 |
| 357 | .IX Item "List of Failed" |
| 358 | A list of the tests which failed. Successive failures may be |
| 359 | abbreviated (ie. 15\-20 to indicate that tests 15, 16, 17, 18, 19 and |
| 360 | 20 failed). |
| 361 | .Sh "Functions" |
| 362 | .IX Subsection "Functions" |
| 363 | Test::Harness currently only has one function, here it is. |
| 364 | .IP "\fBruntests\fR" 4 |
| 365 | .IX Item "runtests" |
| 366 | .Vb 1 |
| 367 | \& my $allok = runtests(@test_files); |
| 368 | .Ve |
| 369 | .Sp |
| 370 | This runs all the given \f(CW@test_files\fR and divines whether they passed |
| 371 | or failed based on their output to \s-1STDOUT\s0 (details above). It prints |
| 372 | out each individual test which failed along with a summary report and |
| 373 | a how long it all took. |
| 374 | .Sp |
| 375 | It returns true if everything was ok. Otherwise it will \fIdie()\fR with |
| 376 | one of the messages in the \s-1DIAGNOSTICS\s0 section. |
| 377 | .SH "EXPORT" |
| 378 | .IX Header "EXPORT" |
| 379 | \&\f(CW&runtests\fR is exported by Test::Harness per default. |
| 380 | .PP |
| 381 | \&\f(CW$verbose\fR and \f(CW$switches\fR are exported upon request. |
| 382 | .SH "DIAGNOSTICS" |
| 383 | .IX Header "DIAGNOSTICS" |
| 384 | .ie n .IP """All tests successful.\enFiles=%d, Tests=%d, %s""" 4 |
| 385 | .el .IP "\f(CWAll tests successful.\enFiles=%d, Tests=%d, %s\fR" 4 |
| 386 | .IX Item "All tests successful.nFiles=%d, Tests=%d, %s" |
| 387 | If all tests are successful some statistics about the performance are |
| 388 | printed. |
| 389 | .ie n .IP """FAILED tests %s\en\etFailed %d/%d tests, %.2f%% okay.""" 4 |
| 390 | .el .IP "\f(CWFAILED tests %s\en\etFailed %d/%d tests, %.2f%% okay.\fR" 4 |
| 391 | .IX Item "FAILED tests %sntFailed %d/%d tests, %.2f%% okay." |
| 392 | For any single script that has failing subtests statistics like the |
| 393 | above are printed. |
| 394 | .ie n .IP """Test returned status %d (wstat %d)""" 4 |
| 395 | .el .IP "\f(CWTest returned status %d (wstat %d)\fR" 4 |
| 396 | .IX Item "Test returned status %d (wstat %d)" |
| 397 | Scripts that return a non-zero exit status, both \f(CW\*(C`$? >> 8\*(C'\fR |
| 398 | and \f(CW$?\fR are printed in a message similar to the above. |
| 399 | .ie n .IP """Failed 1 test, %.2f%% okay. %s""" 4 |
| 400 | .el .IP "\f(CWFailed 1 test, %.2f%% okay. %s\fR" 4 |
| 401 | .IX Item "Failed 1 test, %.2f%% okay. %s" |
| 402 | .PD 0 |
| 403 | .ie n .IP """Failed %d/%d tests, %.2f%% okay. %s""" 4 |
| 404 | .el .IP "\f(CWFailed %d/%d tests, %.2f%% okay. %s\fR" 4 |
| 405 | .IX Item "Failed %d/%d tests, %.2f%% okay. %s" |
| 406 | .PD |
| 407 | If not all tests were successful, the script dies with one of the |
| 408 | above messages. |
| 409 | .ie n .IP """FAILED\-\-Further testing stopped: %s""" 4 |
| 410 | .el .IP "\f(CWFAILED\-\-Further testing stopped: %s\fR" 4 |
| 411 | .IX Item "FAILED--Further testing stopped: %s" |
| 412 | If a single subtest decides that further testing will not make sense, |
| 413 | the script dies with this message. |
| 414 | .SH "ENVIRONMENT" |
| 415 | .IX Header "ENVIRONMENT" |
| 416 | .ie n .IP """HARNESS_ACTIVE""" 4 |
| 417 | .el .IP "\f(CWHARNESS_ACTIVE\fR" 4 |
| 418 | .IX Item "HARNESS_ACTIVE" |
| 419 | Harness sets this before executing the individual tests. This allows |
| 420 | the tests to determine if they are being executed through the harness |
| 421 | or by any other means. |
| 422 | .ie n .IP """HARNESS_COLUMNS""" 4 |
| 423 | .el .IP "\f(CWHARNESS_COLUMNS\fR" 4 |
| 424 | .IX Item "HARNESS_COLUMNS" |
| 425 | This value will be used for the width of the terminal. If it is not |
| 426 | set then it will default to \f(CW\*(C`COLUMNS\*(C'\fR. If this is not set, it will |
| 427 | default to 80. Note that users of Bourne-sh based shells will need to |
| 428 | \&\f(CW\*(C`export COLUMNS\*(C'\fR for this module to use that variable. |
| 429 | .ie n .IP """HARNESS_COMPILE_TEST""" 4 |
| 430 | .el .IP "\f(CWHARNESS_COMPILE_TEST\fR" 4 |
| 431 | .IX Item "HARNESS_COMPILE_TEST" |
| 432 | When true it will make harness attempt to compile the test using |
| 433 | \&\f(CW\*(C`perlcc\*(C'\fR before running it. |
| 434 | .Sp |
| 435 | \&\fB\s-1NOTE\s0\fR This currently only works when sitting in the perl source |
| 436 | directory! |
| 437 | .ie n .IP """HARNESS_FILELEAK_IN_DIR""" 4 |
| 438 | .el .IP "\f(CWHARNESS_FILELEAK_IN_DIR\fR" 4 |
| 439 | .IX Item "HARNESS_FILELEAK_IN_DIR" |
| 440 | When set to the name of a directory, harness will check after each |
| 441 | test whether new files appeared in that directory, and report them as |
| 442 | .Sp |
| 443 | .Vb 1 |
| 444 | \& LEAKED FILES: scr.tmp 0 my.db |
| 445 | .Ve |
| 446 | .Sp |
| 447 | If relative, directory name is with respect to the current directory at |
| 448 | the moment \fIruntests()\fR was called. Putting absolute path into |
| 449 | \&\f(CW\*(C`HARNESS_FILELEAK_IN_DIR\*(C'\fR may give more predictable results. |
| 450 | .ie n .IP """HARNESS_IGNORE_EXITCODE""" 4 |
| 451 | .el .IP "\f(CWHARNESS_IGNORE_EXITCODE\fR" 4 |
| 452 | .IX Item "HARNESS_IGNORE_EXITCODE" |
| 453 | Makes harness ignore the exit status of child processes when defined. |
| 454 | .ie n .IP """HARNESS_NOTTY""" 4 |
| 455 | .el .IP "\f(CWHARNESS_NOTTY\fR" 4 |
| 456 | .IX Item "HARNESS_NOTTY" |
| 457 | When set to a true value, forces it to behave as though \s-1STDOUT\s0 were |
| 458 | not a console. You may need to set this if you don't want harness to |
| 459 | output more frequent progress messages using carriage returns. Some |
| 460 | consoles may not handle carriage returns properly (which results in a |
| 461 | somewhat messy output). |
| 462 | .ie n .IP """HARNESS_PERL_SWITCHES""" 4 |
| 463 | .el .IP "\f(CWHARNESS_PERL_SWITCHES\fR" 4 |
| 464 | .IX Item "HARNESS_PERL_SWITCHES" |
| 465 | Its value will be prepended to the switches used to invoke perl on |
| 466 | each test. For example, setting \f(CW\*(C`HARNESS_PERL_SWITCHES\*(C'\fR to \f(CW\*(C`\-W\*(C'\fR will |
| 467 | run all tests with all warnings enabled. |
| 468 | .ie n .IP """HARNESS_VERBOSE""" 4 |
| 469 | .el .IP "\f(CWHARNESS_VERBOSE\fR" 4 |
| 470 | .IX Item "HARNESS_VERBOSE" |
| 471 | If true, Test::Harness will output the verbose results of running |
| 472 | its tests. Setting \f(CW$Test::Harness::verbose\fR will override this. |
| 473 | .SH "EXAMPLE" |
| 474 | .IX Header "EXAMPLE" |
| 475 | Here's how Test::Harness tests itself |
| 476 | .PP |
| 477 | .Vb 10 |
| 478 | \& $ cd ~/src/devel/Test-Harness |
| 479 | \& $ perl -Mblib -e 'use Test::Harness qw(&runtests $verbose); |
| 480 | \& $verbose=0; runtests @ARGV;' t/*.t |
| 481 | \& Using /home/schwern/src/devel/Test-Harness/blib |
| 482 | \& t/base..............ok |
| 483 | \& t/nonumbers.........ok |
| 484 | \& t/ok................ok |
| 485 | \& t/test-harness......ok |
| 486 | \& All tests successful. |
| 487 | \& Files=4, Tests=24, 2 wallclock secs ( 0.61 cusr + 0.41 csys = 1.02 CPU) |
| 488 | .Ve |
| 489 | .SH "SEE ALSO" |
| 490 | .IX Header "SEE ALSO" |
| 491 | Test and Test::Simple for writing test scripts, Benchmark for |
| 492 | the underlying timing routines, Devel::CoreStack to generate core |
| 493 | dumps from failed tests and Devel::Cover for test coverage |
| 494 | analysis. |
| 495 | .SH "AUTHORS" |
| 496 | .IX Header "AUTHORS" |
| 497 | Either Tim Bunce or Andreas Koenig, we don't know. What we know for |
| 498 | sure is, that it was inspired by Larry Wall's \s-1TEST\s0 script that came |
| 499 | with perl distributions for ages. Numerous anonymous contributors |
| 500 | exist. Andreas Koenig held the torch for many years. |
| 501 | .PP |
| 502 | Current maintainer is Michael G Schwern <schwern@pobox.com> |
| 503 | .SH "TODO" |
| 504 | .IX Header "TODO" |
| 505 | Provide a way of running tests quietly (ie. no printing) for automated |
| 506 | validation of tests. This will probably take the form of a version |
| 507 | of \fIruntests()\fR which rather than printing its output returns raw data |
| 508 | on the state of the tests. (Partially done in Test::Harness::Straps) |
| 509 | .PP |
| 510 | Fix \s-1HARNESS_COMPILE_TEST\s0 without breaking its core usage. |
| 511 | .PP |
| 512 | Figure a way to report test names in the failure summary. |
| 513 | .PP |
| 514 | Rework the test summary so long test names are not truncated as badly. |
| 515 | (Partially done with new skip test styles) |
| 516 | .PP |
| 517 | Deal with \s-1VMS\s0's \*(L"not \enok 4\en\*(R" mistake. |
| 518 | .PP |
| 519 | Add option for coverage analysis. |
| 520 | .SH "BUGS" |
| 521 | .IX Header "BUGS" |
| 522 | \&\s-1HARNESS_COMPILE_TEST\s0 currently assumes it's run from the Perl source |
| 523 | directory. |