I have a go project, test directory contains a single sample test file. Few Functions of the test file are
func TestMain(m *testing.M) {
setup()
code := m.Run()
shutdown()
os.Exit(code)
}
func TestUserLogin(t *testing.T) {
//sample code to make api call and validate response
}
func setup() {
//start service
}
func shutdown() {
//stop service
}
I want to see/generate a coverage report. The following command is being used to run tests:
go test -coverprofile=coverage.out
Output on terminal is
PASS
coverage: 100.0% of statements
coverage.out is getting generated but it consists of only single line
mode: set
coverage.out should have information about the files, lines, etc.
Anything that I am doing wrong here?