Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Converting Go testing output to XUnit

Tags:

go

jenkins

xunit

How can I have the output of Go's testing library output in XUnit format for integration with Jenkins? There are no command line options to output to XML or to XUnit format with go test.

like image 317
robbrit Avatar asked Jan 06 '14 20:01

robbrit


1 Answers

There's a nice little plugin to convert: https://github.com/tebeka/go2xunit

To install it:

go get github.com/tebeka/go2xunit

To use it:

# Run your tests like normal, but pipe the verbose output to the converter
go test -v | $GOPATH/bin/go2xunit > test_output.xml

If you have $GOPATH/bin in your normal $PATH:

go test -v | go2xunit > test_output.xml
like image 53
robbrit Avatar answered Oct 08 '22 04:10

robbrit