goreporter icon indicating copy to clipboard operation
goreporter copied to clipboard

Unit test coverage displays 0%

Open adityacs opened this issue 6 years ago • 7 comments

goreporter displays test coverage as 0%. However, I have few unit tests and running with go test -cover gives me proper coverage %.

Kindly help here.

adityacs avatar Nov 07 '18 08:11 adityacs

Can you post the logs? Or any related information.

wgliang avatar Nov 07 '18 08:11 wgliang

goreporter html image

I am using below command to run goreporter goreporter -p . -r . -f html

console output image

adityacs avatar Nov 07 '18 09:11 adityacs

Yeah, you can see log that the tool can not find your package db on your $GOPATH.

wgliang avatar Nov 07 '18 09:11 wgliang

@wgliang What's the correct command to run goreporter? I have "db" package in "C:\Users\csad\git\vzt-poseidon\src\bitbucket.vtitel.net\vzt-poseidon\db" and goreporter is searching in all wrong places.

Also, GOPATH is set correctly. Still goreporter is looking in wrong folders

adityacs avatar Nov 07 '18 09:11 adityacs

you can just run your command like goreporter -p ./ -r ./ -f html

goreporter will search your packages on your $GOPATH, and it also support vendor. Obviously the path C:\Users\csad\git\vzt-poseidon\src\bitbucket.vtitel.net\vzt-poseidon\db is not in your GOPATH(C:\Users\go).

wgliang avatar Nov 07 '18 10:11 wgliang

I think you can just move your repo into C:\Users\go\src. And then run the command again.

wgliang avatar Nov 07 '18 10:11 wgliang

I have set the GOPATH to C:\Users\csad\git\vzt-poseidon. Still I get same error

adityacs avatar Nov 07 '18 10:11 adityacs