You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 5 Next »

Here is Code Coverage information for Secret Management Service

We are currently at 70.8%

Here is a HTML browser for the code and coverage within:

coverage.html

The same coverage reported from the command line:


How to Generate Code Coverage Reports for Golang Applications

This document covers how to generate HTML Code Coverage Reports for Golang Applications.

Generate and run a test executable which calls your main()
go test -c -covermode=count -coverpkg ./...
./sms.test -test.run "^TestMain$" -test.coverprofile=coverage.cov
Run your Unit tests for their coverage
go test -test.covermode=count -test.coverprofile=unit.out ./...
Merge coverage Reports
go get github.com/wadey/gocovmerge
gocovmerge unit.out coverage.cov > all.out
Generate Reports
# HTML Report File
go tool cover -html all.out -o coverage.html

# Function Coverage Report
go tool cover -func all.out




  • No labels