Menu

Tag

Posts tagged with ‘test anything protocol’

Getting the maximum from TestNG with TAP

kinow @ Mar 10, 2011 01:24:38

Strangely enough, today I decided start to write about TAP (Test Anything Protocol) and received a mail from a Linkedin Group with a white paper about data integration in information systems. Well, let me first explain what is TAP, or Test Anything Protocol. This protocol was created in the beginning of Perl to log test results and is still being used by Perl and other languages (PHPUnit can output TAP too, for instance).

Now, if you already know about TAP and YAML, or if you are like me and like trying things out before reading a long text, then go to the hands on part of this post.

An output in TAP, or a TAP stream, is written in pure text in a human readable way. Like follows:

TAP version 13
1..2
ok 1 Test 1
not ok 2 Missing test parameter: url

( Read more … )

tap4j - A new TAP implementation in Java

kinow @ Oct 12, 2010 09:45:49

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

Cheers