如何以XUnit格式输出Go的测试库输出以与Jenkins集成?没有命令行选项可以输出到XML或XUnit格式go test
.
有一个很好的小插件转换:https://github.com/tebeka/go2xunit
要安装它:
go get github.com/tebeka/go2xunit
要使用它:
# Run your tests like normal, but pipe the verbose output to the converter go test -v | $GOPATH/bin/go2xunit > test_output.xml
如果你有$GOPATH/bin
正常的$PATH
:
go test -v | go2xunit > test_output.xml