Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

generate coverage reports #335

Open
bstpierre opened this issue Jun 9, 2023 · 2 comments
Open

generate coverage reports #335

bstpierre opened this issue Jun 9, 2023 · 2 comments
Labels
enhancement New feature or request

Comments

@bstpierre
Copy link

@dnephin commented in @302 in a discussion about coverage output:

go tool cover (https://pkg.go.dev/cmd/cover) is a similar idea. It can produce 2 reports: coverage percentage per function, and a detailed HTML report. The HTML report effectively has this information, but it's not presented this way.

It seems like it wouldn't be too difficult to copy and modify https://cs.opensource.google/go/go/+/refs/tags/go1.20.3:src/cmd/cover/html.go to make a new report in the format you want. It is possible there is a tool out there that has already done the work, I haven't looked. If you want to build it, it could work as gotestsum tool cover-report or something similar. A new issue for this would be great.

I use coverage reporting in CI, and GitLab's coverage visualization requires cobertura format. I'm currently using gocover-cobertura to generate this report. It would be handy to be able to generate both the junit and cobertura reports from gotestsum all at once -- possibly alongside the html output that was mentioned in the comment that dnephin was replying to.

@mitar
Copy link

mitar commented Jul 14, 2023

I am in the same boat. I am also using Gitlab. Not sure if there is really an issue with additional step of conversion to cobertura format though?

My main issue is that Gitlab supports only one number for coverage, but currently gotestsum returns one number per tested module (see #340).

@mitar
Copy link

mitar commented Mar 23, 2024

I think I am realizing that the coverage for the main package (the . by this tool) is the total coverage? Also it might be useful to run coverage with -coverpkg ./... if you have many integration tests across sub-packages.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants