Cover output formats

2,739 views
Skip to first unread message

christi...@gmail.com

unread,
Jul 14, 2015, 9:06:50 PM7/14/15
to golan...@googlegroups.com
Hey All!

I've noticed that "go test -coverprofile ..." outputs coverage reports in a plain text format, and then there's tools under "go tool cover" to do some additional reporting and metrics on it, or generate the HTML site.

Does anyone know of a converter that would get the coverage metrics into a more standard format, such as gcov or xunit?  I'm looking to get our Go code coverage into Sonar for reporting metrics and quality gates.

Let me know!

Thanks,
Christian

Vivekanand S V

unread,
Jul 15, 2015, 1:10:36 AM7/15/15
to christi...@gmail.com, golan...@googlegroups.com
Check these 3 tools which I use for test and coverage reports. 



1st one generates junit format xml reports from the plain text output. I assume Sonar supports junit (directly or using plugins)
2nd and 3rd together generates coverage reports in Cobertura format. I assume this too is supported by Sonar (directly or using plugins)

I personally use these to track things in Jenkins CI.


--
You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Vivekanand S V

unread,
Jul 15, 2015, 1:31:31 AM7/15/15
to christi...@gmail.com, golan...@googlegroups.com

christi...@gmail.com

unread,
Jul 15, 2015, 12:19:18 PM7/15/15
to golan...@googlegroups.com, christi...@gmail.com
Thank you!  I will try those and report back!

Cheers,
Christian

jej...@gmail.com

unread,
Oct 1, 2015, 10:49:59 AM10/1/15
to golang-nuts, christi...@gmail.com
Did you manage to import the report in sonar? I'm really interested.

Christian Nuss

unread,
Oct 1, 2015, 1:41:13 PM10/1/15
to jej...@gmail.com, golang-nuts
Hey,

Sorry for not reporting back!

Those tools worked great to get coverage metrics out of the standard coverage format that Golang produces.

But...

I was unable to get the metrics to be reported into Sonar, since Sonar ALSO needs a Golang plugin (which probably includes the Abstract Syntax Tree, etc), and according to them (I contacted their support team): "There's no support for Golang planned at this time"

On the bright side...

- The metrics generated by those tools CAN be consumed by a few Jenkins' plugins that read the formats that the tools can convert to (JUnit, etc), and report them on the project dashboard within Jenkins
- We opted to use Coveralls.io to do Golang coverage tracking, and used gocov (mentioned in this thread) and goveralls (https://github.com/mattn/goveralls)

Let me know if you have other questions!

Cheers,
Christian
Reply all
Reply to author
Forward
0 new messages