Guy Biecher
Guy Biecher

Reputation: 11

How can I get code coverage from my Golang Server?

I am using goconvey and other tools to get the code coverage.
This produces a test coverage report but it only shows the coverage for the test case code.
API is hosted on the a Golang server.
I would like to know how much server side code is covered by my
tests(unit,integreation,system tests).
How should I do this?

Upvotes: 1

Views: 531

Answers (1)

jxstanford
jxstanford

Reputation: 3397

Here's what I do:

godep go test -coverprofile cover.out `go list ./... | grep -v vendor`
go tool cover -html=cover.out

That generates a coverage report and then opens a browser window to view it.

Upvotes: 1

Related Questions