Chapter 7. Diagnostics in TAP with YAML

In TAP it is very easy to see whether a test passed or failed, but sometimes you want more information, like adding a stack trace, the raw test, expected and got values or a base64 file content. This extra information is called diagnostics.

Example 7.1. YAMLish diagnostics in TAP

1..3
ok 1
not ok 2
   ---
   expected: 1
   got: 2
   file: sample.MyFirstTest.java
   ...
ok 3 # SKIP

The example above gives you an example of diagnostics in TAP. The syntax is called YAMLish. YAML is a human friendly data serialization standard for all programming languages. It is an acronym for YAML Aint' Markup Language, although some may think it means Yet Another Marlup Language.

As you can see you just have to enclose YAML between '---' and '...', then you add each property followed by a ':' and the property's value. Each YAML is linked to the Test Result above it. In example 1 the YAML contains the diagnostic information of the 'not ok 2' Test Result.