Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
cmd/go: add summary at end of go test results #30507
Currently, there is no way to quickly tell if a test failure occurred after running
You have to scroll up and look for the word
Printing a summary of the test results at the bottom (e.g.
An answer to Issue #27755 suggested using the
EDIT: I'm on Windows 10.
changed the title
Proposal: cmd/go test - Add Test Summary at End of Results
Mar 1, 2019
The very last line should tell you. Even if you're testing many packages, each package that succeeded should only output a single line, so I don't see how this would be a problem unless you were testing a thousand packages at once.
Or, if you simply want to tell if any test failed, just check
Actually, the fact that you need to manually check if any package failed can be subject to human errors, however rare they may be. And you shouldn't be discouraged from decoupling your code into organized packages and writing tests for them just because you want to keep your package count low to make test verification easier. The compiler's tools should be doing that for you.
How exactly do you do this?
Well, @ianlancetaylor asked a question, and we both showed that it's generally simple to check an exit status code. You were asking how to quickly tell if a
Note that #27755 was about a per-package summary. This issue is about a per-run summary over many packages. In general I'm skeptical of summaries: totaling numbers across tests is misleading in various ways, and people won't agree about the level of detail. But I do sympathize with seeing the end of output and not even knowing whether the overall list succeeded.
I propose that in 'package list mode' (see 'go help test' for 'local directory mode' vs 'package list mode'), the overall 'go test' could end by printing FAIL when there are failures (but stay silent for all "ok"/"skip").