Skip to main content

Job Output - Traces

Traces format

The expected format of traces that must be outputted by the MaaS pipeline is the JUnit XML format.

There is no actual specification of this format, but our implementation is based on IBM's documentation of the format.

Many tools are able to generate this format, including most unit testing frameworks. Wikipedia has a list of frameworks with a column specifying if they are able to emit results in JUnit XML format.

<?xml version='1.0' encoding='UTF-8'?>
<testsuites>
<testsuite>
<testcase name="example_test" classname="my.test.categoryA">
<failure>
This is a failure message for the test. This is what is displayed on the intranet when the test fails.

(Obviously, only put this if the test actually failed!)
</failure>
</testcase>
<testcase name="one" time="0.430" classname="my.test.categoryA">
</testcase>
<testcase name="two" time="0.980" classname="my.test.categoryB">
</testcase>
<testcase name="three" time="4.599" classname="my.test.categoryB">
</testcase>
</testsuite>
</testsuites>

In addition to the specification, the following apply:

  • name is the name of the test as displayed on the Intranet
  • time is the time the test took to run, in seconds. Ignored if the test failed. This is used to provide statistics to students on the efficiency of their code.
  • classname is what specifies the hierarchy visible by the student on their trace view. In the example above, they would get the following hierarchy:
my
└── test
├── categoryA
│ ├── example_test ❌
│ └── one ✅
└── categoryB
├── three ✅
└── two ✅

Escaping characters

One of the recurring causes of weird test outputs for students is that your testsuite output contains special characters such as < or >. You will need to escape such characters to not mess up the parsing of the trace file using regular XML escape sequences.

For example, use &lt; and &gt; instead of < and > respectively.

ANSI colors

If your trace failures content contains ANSI color escapes, they will be parsed and rendered by the intranet. All regular 16 colors are supported for both foreground and background, with the 'bright' modifier rendered as bold:

Light theme preview Dark theme preview