TAP Consumer

A TAP Consumer can interpret the output of a TAP Producer to determine how many tests were run, which tests succeedded, and which dianostic information might be usefully reported to the user. In tap4j the consumers are created using the class TapConsumerFactory.

TapConsumer consumer = TapConsumerFactory.makeTap13Consumer();
TapConsumer consumer = TapConsumerFactory.makeTap13YamlConsumer();
TapConsumer consumer = TapConsumerFactory.makeTap13YamlConsumerWithoutSubtests();

The consumer interprets a TAP Stream and transforms it into a TestSet object. A TAP Stream consists of one test set. A test set, by its turn, consists of zero or more test results and exactly one plan. A test set can be determined to have failed or passed.

TestSet testSet = consumer.load(
    "1..2\n" + 
    "ok 1 - no error" + 
    "not ok 2 - io error"
System.out.println( "Number of tests found: " + testSet.getNumberOfTestResults() );
System.out.println( "Test Set failed? " + testSet.containsNotOk() );

Reading TAP using a TAP Consumer from Test Anything Protocol Wiki.