将Go测试输出转换为XUnit [英] Converting Go testing output to XUnit
本文介绍了将Go测试输出转换为XUnit的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
go test
输出到XML或者输出到XUnit格式。解决方案
有一个很好的小插件可以转换: https://github.com/tebeka/go2xunit
安装它:
go get github.com / tebeka / go2xunit
使用它:
#像正常一样运行测试,但将详细输出传输到转换器
go test -v | $ GOPATH / bin / go2xunit> test_output.xml
如果您有 $ GOPATH / bin $ c $在您的正常
$ PATH
中:
go test -v | go2xunit> test_output.xml
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
.
解决方案
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
这篇关于将Go测试输出转换为XUnit的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文