TAP Producer

A TAP Producer produces a TAP Stream. A TAP Stream exists as a file, data stream, encoded in another medium (stored in a PDF file, for instance) or in any other form which can be parsed by a TAP Consumer. In tap4j the producers are created using the class TapProducerFactory.

TapProducer tapProducer = TapProducerFactory.makeTap13Producer();
TapProducer tapProducer = TapProducerFactory.makeTap13YamlProducer();
TapProducer tapProducer = TapProducerFactory.makeTapJunitProducer();

The TAP Stream produced by a TAP Producer must be consumable by a TAP Consumer. The produce and consume processes are decoupled. It means that a server can produce a TAP Stream and another one can download and process it.

TestSet testSet = new TestSet();
testSet.setPlan( new Plan( 2 ) );

TestResult testResult = new TestResult( StatusValues.OK, 1 );
testResult.setDescription( "- no error" );
testSet.addTestResult( testResult );

TestResult anotherTestResult = new TestResult( StatusValues.NOT_OK, 2 );
anotherTestResult.setDescription( "- io error" );
testSet.addTestResult( anotherTestResult );

String tapStream = tapProducer.dump( testSet );

Generating TAP using a TAP Producer from Test Anything Protocol Wiki.