-
Notifications
You must be signed in to change notification settings - Fork 58
Test coverage on PR #41
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
Comments
@masch Could you please try to specify how it should behave to avoid misunderstanding. Side notes regarding code coverage in general. Some time ago I was thinking of creating to add a coverage badge, but I found that it would probably require to add a dependency + manual configuration with a service like https://coveralls.io/ or https://codecov.io/ which I am not sure if it is a good idea to couple this template to such services. Moreover, I was unable to find which one should I use. Additionally, the "default" test coverage shows only coverage for the package being tested. It does not show coverage of dependant packages. For some most developers, it should be OK, however, this is only my assumption. It depends on the test strategy and application/library design as well. We could use -coverpkg but there is one annoying issue with it: golang/go#23883. |
You are totally right, measuring test coverage is a little tricky on Golang. As a internal convention, we do unit test on every package and measure them package by package. Also we are integration/functional test in order to increase the changes to catch a e2e bug. After the tests run fine, we have an internal tool that takes the output from the In the past, I used to configure my personal projects with So I was asking my self, What is a good and generic solution to use on this templates project? |
AnalysisI think that there are two problematic things that can be distinguished here. Executing go test with test coverageI think that we can update the
And a new make target to view the coverage it in browser:
What do you think? Where to output the test coverage resultRight now I see the following options: HTML artifactCreate HTML output created using something like Benefits:
Drawbacks:
CodecovAn example project using Codecov: https://github.com/goreleaser/goreleaser. Benefits:
Drawbacks:
CoverallsAn example project using Coveralls: https://github.com/mattn/goveralls. Similar benefits and drawbacks to Codecov. Next stepsWhat I propose for now is that I can try making a PR for "Executing go test with test coverage". In the meantime, you could focus on "Where to output the test coverage result". You can compare HTML report in artifacts vs Codecov and Coveralls in practice on some fork(s). I think that there is nothing against having both the coverage in HTML file for local development and Codecov or Coveralls at the same time. My first impression (but without configuring it myself) is that Codecov seems to be the way to better and also has a better pricing plan than Coveralls and is also more robust than plain HTML output in artifacts. Also, I feel that the setup should be easy. However I suspect that most of the steps are still needed to be done manually. I think we will possibility end up with a FAQ how to setup Codecov for a new project created using this template. But these are only my guesses and I would prefer if we have some real experience here. Please feel free to comment, agree and disagree. Your feedback, help and experience are more than welcome. |
I think it a greet start from you deeply research, nice work. Here are my comments:
Yeah, it a great use Also as I'm a big fun of the use of terminal, I also use goverreport tool to get an easy test measure. Do you know it?
I didn't know it, so from what I red it could be a good output of test result, but personally I prefer a PR's comment like Codecov does it. But if a user doesn't want to use an external tool, it will be very useful.
Both tools and test coverage mechanism are great. I know Coverall but I never use it on my projects, but I use a lot Codecov. So in my personal experience, I would prefer the use of Codecov. The heat map on PR's comments and the UI on their web are better than Coveralls.
I think it's a great start the one that you have proposed it, If you want to I could do a POC with it. |
Can you please review: #43 Doing a PoC with Codecov would help me 😉 Thanks for sharing goverreport with me. However, I do not know how I could integrate it right now. Currently I think of following improvements for this repo:
|
Great! All the improvements are wonderful I can't wait to see on the road! 🎉 |
Hey! @pellared |
Thank you for the invitation!! 🎉 |
@masch I am happy that I could help you. Please feel free to create a new issue if you have some idea how to improve this repository template. |
Hi!
Have you ever considered to add a Github action on PR to messure the test coverage of it?
I love your golang template project!
Thanks!
The text was updated successfully, but these errors were encountered: