I’m trying to get coverage of a go application regarding an entire project.
But I get a report that only includes those files that the tests “touch”
I have several files with golang tests:
example1_test.go example2_test.go example3_test.go
in the script I move the test one by one to the desired position in the project and run
go test -v -cover -covermode=atomic -run Test_Fuzz -coverpkg=./... ./... -test.gocoverdir=$COVDATA/out
As a result, I get information about the coverage of each test.
After which I combine the received data:
go tool covdata textfmt -i=$COVDATA/out -o $COVDATA/cover.out
And I generate a report:
scov -htmldir $COVDATA/html/ -srcdir /home/${USER}/go/src/ $COVDATA/cover.out
As a result, I get almost what I need, but the report does not contain those files that were not touched by the tests.
For example, I also want to see some module that is not used anywhere yet but is included in the project in the report, so that it looks like the maximum that we need to strive for
aibure is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.