📜 ⬆️ ⬇️

Testing Perl programs for beginners. Test Anything Protocol (TAP)

Before I turn to the description of the work with the modules Test :: More, Test :: Harness and Test :: Simple, I would like to clarify what TAP is - mentioning which, from time to time, appears when discussing the topic of program testing.

The text of this topic is basically a translation of the appropriate text from Wikipedia (link below).
Perhaps the only material in this topic that I have practically not been exposed to.
processing other than translation. :)

Test Anything Protocol (TAP) is a uniform format for transmitting test results to programs that interpret results, and depending on them, perform some actions. A simpler definition is a single format for displaying test results .
')
TAP is not tied to a specific programming language, however, it is most often used by Perl programmers.

The main TAP format:
1..N
ok 1 Description # Directive
# Diagnostic
...
ok 47 Description
ok 48 Description
more tests ...


For example, testing reading data from a file might give the following result:
1..4
ok 1 - Input file opened
not ok 2 - First line of input valid
ok 3 - Read the rest of the file
not ok 4 - Summarized correctly # TODO Not written yet


Using TAP allows you to separate the test program from the program that automatically runs test scripts, receives and processes the results, analyzes them. The advantages of this approach:


TAP analyzers


A list of libraries (modules) that are designed to analyze TAP and publish test results.



TAP Libraries


List of libraries intended for writing tests and performing data output in TAP format.



useful links


RUS

Writing automatic tests and phpUnit environment

ENG

http://en.wikipedia.org/wiki/Test_Anything_Protocol
testanything.org. TAP-specific resource

Source: https://habr.com/ru/post/30398/


All Articles