-
Notifications
You must be signed in to change notification settings - Fork 17.7k
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
cmd/go: add summary at end of go test results #30507
Comments
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? |
What system are you running on? GNU/Linux? Windows? |
Programmatically you check the exit code by checking whether os/exec's |
On unix-y shells, you can do |
@mvdan |
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 |
The answer from this SO thread (https://stackoverflow.com/a/334890/7824245) says the I'll try it out and see how that works. |
Nevermind, I found a better way to quickly detect test failures from this SO thread:
Though I still kinda wish that the Go team would officially add this feature in the future. |
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"). |
@rsc |
Per discussion with @golang/proposal-review, let's move forward with @rsc's idea. |
Change https://golang.org/cl/170948 mentions this issue: |
what is the resolution to this issue?? do we have any command which gives result in asked manner.. |
This issue is not yet resolved. |
Fixes golang#30507 Change-Id: Ic598e4d5f71c624fcde051982bf85533e2f18e8d
Fixes golang#30507 Change-Id: Ic598e4d5f71c624fcde051982bf85533e2f18e8d
Currently, there is no way to quickly tell if a test failure occurred after running
go test
.You have to scroll up and look for the word
FAIL
or search for it in a text editor.Printing a summary of the test results at the bottom (e.g.
Tests run: 10, Failures: 2, Errors: 0, Skipped: 0
) would make it easy to tell at a glance if any test failures occurred or not.An answer to Issue #27755 suggested using the
-json
flag, but I haven't seen any good documentation or examples on how to use it. Also, this approach seems too convoluted for something that other languages have for tests out of the box.EDIT: I'm on Windows 10.
The text was updated successfully, but these errors were encountered: