Test Anything Protocol

The Test Anything Protocol (TAP) is a protocol to allow communication between unit tests and a test harness. It allows individual tests (TAP producers) to communicate test results to the testing harness in a language-agnostic way. Originally developed for unit testing of the Perl interpreter in 1987, producers and parsers are now available for many development platforms.

History

TAP was created for the first version of the Perl programming language (released in 1987), as part of the Perl's core test harness (t/TEST). The Test::Harness module was written by Tim Bunce and Andreas König to allow Perl module authors to take advantage of TAP.

Development of TAP, including standardization of the protocol, writing of test producers and consumers, and evangelizing the language is coordinated at the TestAnything website.[1]

Specification

A formal specification for this protocol exists in the TAP::Spec::Parser and TAP::Parser::Grammar modules. The behavior of the Test::Harness module is the de facto TAP standard implementation, along with a writeup of the specification on http://testanything.org.

A project to produce an IETF standard for TAP was initiated in August 2008, at YAPC::Europe 2008.[1]

Usage examples

Here's an example of TAP's general format:

1..48
ok 1 Description # Directive
# Diagnostic
....
ok 47 Description
ok 48 Description

For example, a test file's output might look like:

1..4
ok 1 - Input file opened
not ok 2 - First line of the input valid.
    More output from test 2. There can be
    arbitrary number of lines for any output
    so long as there is at least some kind
    of whitespace at beginning of line.
ok 3 - Read the rest of the file
#TAP meta information
not ok 4 - Summarized correctly # TODO Not written yet

References

  1. 1 2 "The Test Anything Protocol website". Retrieved September 4, 2008.

External links

This article is issued from Wikipedia - version of the 2/5/2016. The text is available under the Creative Commons Attribution/Share Alike but additional terms may apply for the media files.