JUnit includes an XML report generator that it calls the legacy xml report . Many tools integrate with this format so it is very useful. However, this report has no concept of nesting tests. Therefore when used with a nested test style in Kotest, it will include parent tests as orphans.
To solve this, Kotest has it's own implementation of the same format, that is configurable on whether to include parent tests and/or collapse the names.
To set this up, we need to add the
JunitXmlReporter to our project
through project config.
Additionally, the reporter needs to know where your build output folder is by setting a system property, so we configure that in the tests block in gradle.
The reporter has two parameters:
includeContainerswhen true, all intermediate tests are included in the report as tests in their own right. Defaults to false.
useTestPathAsNamewhen true, the full test path will be used as the name. In other words the name will include the name of any parent tests as a single string.