Golang coverprofile output format

The golang-nuts community (https://groups.google.com/forum/#!forum/golang-nuts) provided a couple useful tools for converting Go coverage into more useful formats.

JUnit Format (for summarizing test executions):

# Prerequisites
go get github.com/jstemmer/go-junit-report
# Tests
go test -v | go-junit-report > report.xml

Cobertura Format (for detailing code coverage):

# Prerequisites
go get github.com/axw/gocov/gocov
go get github.com/AlekSi/gocov-xml
# Coverage
go test -coverprofile=cover.out
gocov convert cover.out | gocov-xml > coverage.xml

The thread that pointed me in this direction was here: https://groups.google.com/forum/#!topic/golang-nuts/iUc68Zrxk_c


The fields are:

name.go:line.column,line.column numberOfStatements count

Source

Tags:

Testing

Go

Cover