Open Test Reporting
The Buildnote CLI collects Open Test Reporting test results and sends them to Buildnote. Open Test Reporting is a test report specification maintained by the JUnit team. It isn't tied to any language or framework, and tools such as the JUnit Platform produce it. Buildnote supports both its event-based and hierarchical XML formats.
Producing reports with JUnit Platform
To make JUnit Platform write Open Test Reporting XML, add org.junit.platform:junit-platform-reporting to the test runtime classpath and enable the listener with configuration parameters. For Gradle:
dependencies {
testRuntimeOnly("org.junit.platform:junit-platform-reporting")
}
tasks.withType<Test>().configureEach {
systemProperty("junit.platform.reporting.open.xml.enabled", "true")
systemProperty(
"junit.platform.reporting.output.dir",
layout.buildDirectory.dir("test-results/$name").get().asFile.absolutePath
)
}Each test run then writes an open-test-report.xml file into the configured output directory.
Configuration
To collect Open Test Reporting test results, add this section to your buildnote.json config file:
{
"collect": {
...
"otr": {
"enabled": true,
"include": [
"**/open-test-report.xml"
]
}
...
}
}Metadata
To attach your own metadata to Open Test Reporting test results, add a metadata section:
{
"collect": {
...
"otr": {
"enabled": true,
"include": [
"**/open-test-report.xml"
],
"metadata": {
"test-user": "{{ env.USER }}",
"build-environment": "{{ env.BUILD_ENV }}"
}
}
...
}
}Excluding paths
To leave some paths out of collection, list their globs under exclude:
{
"collect": {
...
"otr": {
"exclude": [
"**/*excluded.xml",
"/any/excluded/glob/**/"
]
}
...
}
}