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].
[![Build status][github-actions-badge]][github-actions-link]
Go version 1.17 or higher is required. Install or update using the go get
command:
go get -u github.com/vitessio/go-junit-report
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 2>&1 ./... | go-junit-report -set-exit-code > report.xml
JSON produced by go test -json
is supported by the gojson
parser. Note that
stderr
still needs to be redirected to go-junit-report in order for build
errors to be detected. For example:
go test -json 2>&1 | go-junit-report -parser gojson > report.xml
go test -v -bench . -count 5 2>&1 | go-junit-report -out report.xml
This is forked version from https://github.com/jstemmer/go-junit-report