I'm trying to figure out how to generate coverage metrics for integration tests. I have a webapp with two packages: a 'handlers' package that specifies a set of http apis and a 'users' package to fetch user data from the database.
I have unit tests for each package and can use go test -cover to generate coverage reports for each package.
In addition, I have some integration tests to test the end-to-end flow. The tests start the app using httptest and send some http requests to the server. Since go test -cover generates metrics on a per-package basis, the metrics aren't accurate. For instance, if the integration tests are defined in the main package, I only see coverage metrics for the main package. I'd like to also see how much of the code in the handlers and users package was tested.
Is this possible?
Thanks
Sid