{
    "mode": "perldoc",
    "parameter": "Test::Harness",
    "section": "",
    "url": "https://www.chedong.com/phpMan.php/perldoc/Test%3A%3AHarness/json",
    "generated": "2026-06-13T21:47:46Z",
    "synopsis": "use Test::Harness;\nruntests(@testfiles);",
    "sections": {
        "NAME": {
            "content": "Test::Harness - Run Perl standard test scripts with statistics\n",
            "subsections": []
        },
        "VERSION": {
            "content": "Version 3.43\n",
            "subsections": []
        },
        "SYNOPSIS": {
            "content": "use Test::Harness;\n\nruntests(@testfiles);\n",
            "subsections": []
        },
        "DESCRIPTION": {
            "content": "Although, for historical reasons, the Test::Harness distribution takes its name from this module\nit now exists only to provide TAP::Harness with an interface that is somewhat backwards\ncompatible with Test::Harness 2.xx. If you're writing new code consider using TAP::Harness\ndirectly instead.\n\nEmulation is provided for \"runtests\" and \"executetests\" but the pluggable 'Straps' interface\nthat previous versions of Test::Harness supported is not reproduced here. Straps is now\navailable as a stand alone module: Test::Harness::Straps.\n\nSee TAP::Parser, TAP::Harness for the main documentation for this distribution.\n",
            "subsections": []
        },
        "FUNCTIONS": {
            "content": "The following functions are available.\n\nruntests( @testfiles )\nThis runs all the given *@testfiles* and divines whether they passed or failed based on their\noutput to STDOUT (details above). It prints out each individual test which failed along with a\nsummary report and a how long it all took.\n\nIt returns true if everything was ok. Otherwise it will \"die()\" with one of the messages in the\nDIAGNOSTICS section.\n\nexecutetests( tests => \\@testfiles, out => \\*FH )\nRuns all the given @testfiles (just like \"runtests()\") but doesn't generate the final report.\nDuring testing, progress information will be written to the currently selected output filehandle\n(usually \"STDOUT\"), or to the filehandle given by the \"out\" parameter. The *out* is optional.\n\nReturns a list of two values, $total and $failed, describing the results. $total is a hash ref\nsummary of all the tests run. Its keys and values are this:\n\nbonus           Number of individual todo tests unexpectedly passed\nmax             Number of individual tests ran\nok              Number of individual tests passed\nsubskipped     Number of individual tests skipped\ntodo            Number of individual todo tests\n\nfiles           Number of test files ran\ngood            Number of test files passed\nbad             Number of test files failed\ntests           Number of test files originally given\nskipped         Number of test files skipped\n\nIf \"$total->{bad} == 0\" and \"$total->{max} > 0\", you've got a successful test.\n\n$failed is a hash ref of all the test scripts that failed. Each key is the name of a test\nscript, each value is another hash representing how that script failed. Its keys are these:\n\nname        Name of the test which failed\nestat       Script's exit value\nwstat       Script's wait status\nmax         Number of individual tests\nfailed      Number which failed\ncanon       List of tests which failed (as string).\n\n$failed should be empty if everything passed.\n",
            "subsections": []
        },
        "EXPORT": {
            "content": "&runtests is exported by \"Test::Harness\" by default.\n\n&executetests, $verbose, $switches and $debug are exported upon request.\n\nENVIRONMENT VARIABLES THAT TAP::HARNESS::COMPATIBLE SETS\n\"Test::Harness\" sets these before executing the individual tests.\n\n\"HARNESSACTIVE\"\nThis is set to a true value. It allows the tests to determine if they are being executed\nthrough the harness or by any other means.\n\n\"HARNESSVERSION\"\nThis is the version of \"Test::Harness\".\n\nENVIRONMENT VARIABLES THAT AFFECT TEST::HARNESS\n\"HARNESSPERLSWITCHES\"\nSetting this adds perl command line switches to each test file run.\n\nFor example, \"HARNESSPERLSWITCHES=-T\" will turn on taint mode.\n\"HARNESSPERLSWITCHES=-MDevel::Cover\" will run \"Devel::Cover\" for each test.\n\n\"-w\" is always set. You can turn this off in the test with \"BEGIN { $^W = 0 }\".\n\n\"HARNESSTIMER\"\nSetting this to true will make the harness display the number of milliseconds each test\ntook. You can also use prove's \"--timer\" switch.\n\n\"HARNESSVERBOSE\"\nIf true, \"Test::Harness\" will output the verbose results of running its tests. Setting\n$Test::Harness::verbose will override this, or you can use the \"-v\" switch in the prove\nutility.\n\n\"HARNESSOPTIONS\"\nProvide additional options to the harness. Currently supported options are:\n\n\"j<n>\"\nRun <n> (default 9) parallel jobs.\n\n\"c\" Try to color output. See \"new\" in TAP::Formatter::Base.\n\n\"a<file.tgz>\"\nWill use TAP::Harness::Archive as the harness class, and save the TAP to \"file.tgz\"\n\n\"fPackage-With-Dashes\"\nSet the formatterclass of the harness being run. Since the \"HARNESSOPTIONS\" is\nseperated by \":\", we use \"-\" instead.\n\nMultiple options may be separated by colons:\n\nHARNESSOPTIONS=j9:c make test\n\n\"HARNESSSUBCLASS\"\nSpecifies a TAP::Harness subclass to be used in place of TAP::Harness.\n\n\"HARNESSSUMMARYCOLORSUCCESS\"\nDetermines the Term::ANSIColor for the summary in case it is successful. This color defaults\nto 'green'.\n\n\"HARNESSSUMMARYCOLORFAIL\"\nDetermines the Term::ANSIColor for the failure in case it is successful. This color defaults\nto 'red'.\n",
            "subsections": []
        },
        "Taint Mode": {
            "content": "Normally when a Perl program is run in taint mode the contents of the \"PERL5LIB\" environment\nvariable do not appear in @INC.\n\nBecause \"PERL5LIB\" is often used during testing to add build directories to @INC \"Test::Harness\"\npasses the names of any directories found in \"PERL5LIB\" as -I switches. The net effect of this\nis that \"PERL5LIB\" is honoured even in taint mode.\n",
            "subsections": []
        },
        "SEE ALSO": {
            "content": "TAP::Harness\n",
            "subsections": []
        },
        "BUGS": {
            "content": "Please report any bugs or feature requests to \"bug-test-harness at rt.cpan.org\", or through the\nweb interface at <http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Test-Harness>. I will be\nnotified, and then you'll automatically be notified of progress on your bug as I make changes.\n",
            "subsections": []
        },
        "AUTHORS": {
            "content": "Andy Armstrong \"<andy@hexten.net>\"\n\nTest::Harness 2.64 (maintained by Andy Lester and on which this module is based) has this\nattribution:\n\nEither Tim Bunce or Andreas Koenig, we don't know. What we know for\nsure is, that it was inspired by Larry Wall's F<TEST> script that came\nwith perl distributions for ages. Numerous anonymous contributors\nexist.  Andreas Koenig held the torch for many years, and then\nMichael G Schwern.\n",
            "subsections": []
        },
        "LICENCE AND COPYRIGHT": {
            "content": "Copyright (c) 2007-2011, Andy Armstrong \"<andy@hexten.net>\". All rights reserved.\n\nThis module is free software; you can redistribute it and/or modify it under the same terms as\nPerl itself. See perlartistic.\n",
            "subsections": []
        }
    },
    "summary": "Test::Harness - Run Perl standard test scripts with statistics",
    "flags": [],
    "examples": [],
    "see_also": []
}