| GO-JUNIT-REPORT(1) | GO-JUNIT-REPORT(1) |
go-junit-report - convert Go test output to JUnit XML
go-junit-report [-in file] [-out file] [options...]
go-junit-report -version
go-junit-report -help
go-junit-report is a tool that converts go test output to a JUnit compatible XML report, suitable for use with applications such as Jenkins or GitLab CI.
By default, go-junit-report reads go test -v output generated by the standard library testing package from stdin and writes a JUnit XML report to stdout.
Go build and runtime errors are also supported, but this requires that stderr is redirected to go-junit-report as well.
Typical use looks like this:
go test -v 2E<gt>&1 ./... | go-junit-report -set-exit-code E<gt> report.xml
Alternatively, go-junit-report can consume JSON output of go test. In this case, stderr still needs to be redirected for build errors to be detected.
go test -json 2E<gt>&1 | go-junit-report -parser gojson E<gt> report.xml
The -iocopy flag copies stdin directly to stdout, which is useful to still be able to see the go test output.
go test -v 2E<gt>&1 ./... | go-junit-report -set-exit-code -iocopy -out report.xml
If go-junit-report encounters an error during its operation, or doesn’t understand its command-line options, 2 is returned.
If the input logs indicate the tests failed, and -set-exit-code is specified, 1 is returned.
Otherwise, 0 is returned.
Copyright (C) 2025 Andrej Shadura.
| 2025-06-22 |