Skip to content

vitessio/go-junit-report

 
 

Repository files navigation

go-junit-report

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]

Installation

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

Usage

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

More examples

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

Run Tests

go test -v -bench . -count 5 2>&1 | go-junit-report -out report.xml

Declaration

This is forked version from https://github.com/jstemmer/go-junit-report

About

Convert go test output to junit xml

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Go 98.8%
  • Makefile 1.2%