Perl Tap

last modified: April 21, 2006

TAP (Test Anything Protocol) is a simple text format for describing test results. Some example TAP output might look like:

1..4
ok 1 - Input file opened
not ok 2 - First line of the input valid
ok 3 - Read the rest of the file
not ok 4 - Summarized correctly # TODO Not written yet

TAP allows you to :

For details see Test::Harness::TAP (http://search.cpan.org/dist/Test-Harness/lib/Test/Harness/TAP.pod)

TAP is at the core of the majority of the PerlLanguage testing modules living under the Test:: hierarchy on TheCpan (http://search.cpan.org/search?query=Test%3A%3A%3A&mode=dist). See http://qa.perl.org/test-modules.html for a brief summary of some of them, and http://qa.perl.org for more general information on PerlLanguage testing.

The core modules that support TAP in the PerlLanguage are:

While TAP is most commonly used with the PerlLanguage, it's simple enough that you can hack together a basic TAP library with very little effort. TAP libraries exist for PhpLanguage (http://shiflett.org/archive/176), JavaScript (http://www.openjsan.org/doc/t/th/theory/Test/Simple/) and many other languages.

Since TAP tries to be methodology agnostic, you can integrate different testing modules with different testing styles together under a single test harness (e.g., both the xUnit-ish PerlTestClass and the specification-based LectroTest output TAP).

Since TAP is just ASCII it is easy to throw around with pipes, SSH, etc., so you can throw together cross-platform, multi-language, multi-server test farms using your standard Unix toolset.


CategoryPerl, CategoryTesting


Loading...