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 classTapProducerFactory.
TapProducer tapProducer = TapProducerFactory.makeTap13Producer();TapProducer tapProducer = TapProducerFactory.makeTap13YamlProducer();TapProducer tapProducer = TapProducerFactory.makeTapJunitProducer();
The TAP Stream produced by a TAP Producer must be consumable by aTAP 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 );System.out.println(tapStream);
Generating TAP using a TAP Producer fromTest Anything Protocol Wiki.