Skip to content

Commit 8002995

Browse files
committed
go unit test code coverage report in jenkins
Implementing go unit test coverage in jenkins build process using cobertura jenkins plugin and gocovxml. Updated go unit test command to generate xml file using gocov-xml package. Change-Id: I0f516974392ffcec817ef126078d35dc8d78f71f Signed-off-by: rameshthoomu <[email protected]>
1 parent d48a1c2 commit 8002995

File tree

3 files changed

+5
-2
lines changed

3 files changed

+5
-2
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -25,3 +25,4 @@ bddtests/coverage
2525
go-carpet-coverage*
2626
# make node-sdk copied files
2727
sdk/node/lib/protos/*
28+
report.xml

gotools/Makefile

+3-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
# under the License.
1717
#
1818

19-
GOTOOLS = golint govendor goimports protoc-gen-go ginkgo gomega
19+
GOTOOLS = golint govendor goimports protoc-gen-go ginkgo gomega gocov gocovxml
2020
GOTOOLS_BIN = $(patsubst %,$(GOPATH)/bin/%, $(GOTOOLS))
2121

2222
# go tool->path mapping
@@ -25,6 +25,8 @@ go.fqp.golint := github.com/golang/lint/golint
2525
go.fqp.goimports := golang.org/x/tools/cmd/goimports
2626
go.fqp.ginkgo := github.com/onsi/ginkgo/ginkgo
2727
go.fqp.gomega := github.com/onsi/gomega
28+
go.fqp.gocov := github.com/axw/gocov/...
29+
go.fqp.gocovxml := github.com/AlekSi/gocov-xml
2830

2931
all: $(GOTOOLS_BIN)
3032

scripts/goUnitTests.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,4 @@ trap cleanup 0
1919
echo "DONE!"
2020

2121
echo "Running tests..."
22-
go test -cover -p 1 -timeout=20m $PKGS
22+
gocov test $PKGS -p 1 -timeout=20m | gocov-xml > report.xml

0 commit comments

Comments
 (0)