Open Test Reporting
Buildnote CLI can collect Open Test Reporting test results and submit them to the buildnote service. Open Test Reporting is a language and framework agnostic test report specification maintained by the JUnit team, produced by tools such as the JUnit Platform. Both the event-based and the hierarchical XML formats are supported.
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 enable collection of Open Test Reporting test results add the following section to buildnote.json config file
{
"collect": {
...
"otr": {
"enabled": true,
"include": [
"**/open-test-report.xml"
]
}
...
}
}Metadata
You can attach metadata to Open Test Reporting test results by configuring the metadata section:
{
"collect": {
...
"otr": {
"enabled": true,
"include": [
"**/open-test-report.xml"
],
"metadata": {
"test-user": "{{ env.USER }}",
"build-environment": "{{ env.BUILD_ENV }}"
}
}
...
}
}Excluding paths
To exclude any paths from collection configure exclude section with required globs.
{
"collect": {
...
"otr": {
"exclude": [
"**/*excluded.xml",
"/any/excluded/glob/**/"
]
}
...
}
}