gotest + beatiful
gotestiful is a go terminal program that wraps 'go test' to streamline tests running and config and also improves the coverage presentation output.
- run
go install github.com/alex-parra/gotestiful@latest - run
gotestifulfrom the root of any go project (where go.mod is)
Comparison of go test and gotestiful on kubernetes/client-go
gotestifulruns tests for the current folder eg.go test ./...gotestiful -helpshows examples and flags infosgotesttiful some/pkgruns only that package eg.go test some/pkggotestiful -cache=falseruns tests without cache eg.go test -count=1 ...gotestiful initcreates a base configuration in the current folder
(the config file is optional. you may opt to use flags only)- ... see
gotestiful -helpfor all flags
-
config file per project
rungotestiful initfrom your project root to create a.gotestifulconfig file and then adjust the settings.
afterwards you only need to rungotestifuland the config is read -
exclusion list
add packages (or just prefixes) to the configexcludearray to not test those packages.
example: exclude generated code such as protobuf packages -
global coverage summary
shows the overall code coverage calculated from the coverage score of each tested package. -
open html coverage detail report
set the-reportflag and the coverage html detail will open (eg.go tool cover -html)
Made with contributors-img.