diff options
author | Kiran Kamineni <kiran.k.kamineni@intel.com> | 2018-04-19 21:27:01 -0700 |
---|---|---|
committer | Kiran Kamineni <kiran.k.kamineni@intel.com> | 2018-04-20 14:48:26 -0700 |
commit | 7597c1552d636712391d7269d0373747384ced0d (patch) | |
tree | ead1edb21947111935417432231d0bab6a1f058c /sms-service/doc/coverage.md | |
parent | 333da2a55ef9535a32d90e249ab7f3842944db6a (diff) |
Refactor logger and use it everywhere
Refactored the logger to print the right line
number. This is done by using the runtime.caller
function within the logger.output function
Issue-ID: AAF-257
Change-Id: Ie26de43ca74c71f382d3b5f93ebd4eaf6d51e2b4
Signed-off-by: Kiran Kamineni <kiran.k.kamineni@intel.com>
Diffstat (limited to 'sms-service/doc/coverage.md')
-rw-r--r-- | sms-service/doc/coverage.md | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/sms-service/doc/coverage.md b/sms-service/doc/coverage.md new file mode 100644 index 0000000..6168342 --- /dev/null +++ b/sms-service/doc/coverage.md @@ -0,0 +1,41 @@ +## Code Coverage Reports for Golang Applications ## + +This document covers how to generate HTML Code Coverage Reports for +Golang Applications. + +#### Generate a test executable which calls your main() + +```sh +$ go test -c -covermode=count -coverpkg ./... +``` + +#### Run the generated application to produce a new coverage report + +```sh +$ ./sms.test -test.run "^TestMain$" -test.coverprofile=coverage.cov +``` + +#### Run your unit tests to produce their coverage report + +```sh +$ go test -test.covermode=count -test.coverprofile=unit.out ./... +``` + +#### Merge the two coverage Reports + +```sh +$ go get github.com/wadey/gocovmerge +$ gocovmerge unit.out coverage.cov > all.out +``` + +#### Generate HTML Report + +```sh +$ go tool cover -html all.out -o coverage.html +``` + +#### Generate Function Report + +```sh +$ go tool cover -func all.out +```
\ No newline at end of file |