A month ago I started a project to help me in my new version of the TestLink Hudson plug-in. The plugin now relies heavily on Apache Maven for test execution. After reading a post on TestLink forum about an automation done using TAP, I googled to learn what that acronym stood for.
TAP is the abbreviation of Test Anything Protocol.It is a protocol to produce information about test execution and used mainly by the Perl community. For instance, you can test your system using PHPUnit, JUnit, Selenium or even a C class and produce what they call a TAP Stream. This stream’s content is like follows:
TAP version 13 1..2 ok 1 Test 1 ok 2
The text above tells us that we are using the version 13 of TAP. That we have 2 tests (1..’2’) and that both tests were executed without errors. TAP is a human readable text that can be interpreted by a software for audit, report or whatever. Another tool can then parse this TAP Stream and prepare Reports, update Database among other uses (this is what TestLink Hudson plug-in is going to do on its new version ;-).
tap4j is a simple Java implementation of the TAP protocol (sorry to repeat the protocol part of the acronym right after it, but sounds cool :-). The project is built with Java 1.5 and Maven and hosted on SourceForge. The artifacts are published on Maven Central Repository but the jar is also uploaded into SourceForge. Up to now the project has only two members. Apart from me, there is CÃ©sar Fernandes Almeida, a friend from university that is helping me with the ideas, tests and code. But we really need more help, specially from people that know Perl (Harness, Simple, etc) to help us make integration tests using TAP Streams generated by these tools.
The 1.0 version supports Header, Plan, Footer, Test Results, Comments and Bail Out expressions. All these supported elements can be retrieved through the API, even the comments list. Any invalid text is ignored but you can also retrieve this information using the API.
We are already working on a new version, 1.1. This version will support YAML diagnostics, letting you put a whole Exception stack trace on your TAP Stream. Nice uhn? Check how YAML looks like.
file: foo.t line: 45 description: an important test found: this wanted: that raw_test: is( "this", "that", "an important test" ); extensions: THAC0: 16