vitess
vitess copied to clipboard
Feature Request: Adding a script to get code coverage results
Feature Description
Currently, there is no direct way for developers to get the test coverage results from the go
CLI in an easy UI (HTML-based).
The current way to do the same is:
- Run
go test -coverprofile=test.out <name of the package you want to test>
- Install the
cover
tool provided by Go bygo get golang.org/x/tools/cmd/cover
- Generate the web UI for test results by running
go tool cover -html=test.out
This is cumbersome and adds a barrier to developers when checking for coverage.
Proposal
Add golang.org/x/tools/cmd/cover
to the project, and create a make
script that runs the test on the package you specify and then uses the cover
tool to show the coverage to users.
Use Case(s)
Any developers adding or changing functionalities can use the same to grasp the extent of their test coverage for a particular package. Also, for developers writing tests, this would allow the use of a UI that shows exactly which lines aren't covered, so it becomes easier to target them and write tests for them.
I'd like to work on this issue if the maintainers find the same to be relevant.
Hello @EshaanAgg, thank you for this issue. I think it is a good idea especially given all the work going on right now to improve code coverage throughout the codebase. Feel free to open a Pull Request with the proposed changes and we can review it!
@mattlord WDYT?