TAP, the Test Anything Protocol, is a simple text-based interface between
testing modules or programs and a test harness. The tests (also called
“TAP producers” in this context) write test results in a simple format
on standard output; a test harness (also called “TAP consumer”) will
parse and interpret these results, and properly present them to the user,
and/or register them for later analysis. The exact details of how this
is accomplished can vary among different test harnesses. The Automake
harness will present the results on the console in the usual
fashion (see Testsuite progress on console), and will use the
.trs files (see Basics of test metadata) to store the test
results and related metadata. Apart from that, it will try to remain
as compatible as possible with pre-existing and widespread utilities,
such as the
prove
utility, at least for the simpler usages.
TAP started its life as part of the test harness for Perl, but today it has been (mostly) standardized, and has various independent implementations in different languages; among them, C, C++, Perl, Python, PHP, and Java. For a semi-official specification of the TAP protocol, please refer to the documentation of ‘Test::Harness’.
The most relevant real-world usages of TAP are obviously in the testsuites
of perl
and of many Perl modules. Still, other important
third-party packages, such as git
,
also use TAP in their testsuite.