-
Notifications
You must be signed in to change notification settings - Fork 17.9k
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
proposal: testing: print more information about failing tests at the end #71646
Comments
I definitely felt the same pain. A question is whether to also re-print the test output. In -v mode that would be useful, without -v it would be basically the same output as above. Maybe we should re-print it only with -v? Or maybe the whole thing should only be enabled on -v? |
Also worth noting is that with [mateusz@arch aaa ]$ go test -v .
=== RUN TestOne
=== PAUSE TestOne
=== RUN TestTwo
=== PAUSE TestTwo
=== RUN TestThree
=== PAUSE TestThree
=== CONT TestOne
main_test.go:10: one
=== CONT TestThree
main_test.go:24: three
=== CONT TestTwo
main_test.go:17: two
=== NAME TestOne
main_test.go:12: one
=== NAME TestThree
main_test.go:26: three
--- PASS: TestOne (1.00s)
=== NAME TestTwo
main_test.go:19: two
--- PASS: TestTwo (1.00s)
--- PASS: TestThree (1.00s)
PASS
ok aaa 1.003s Which is unreadable, it would be nice if it grouped this at the end. |
#27755 points to -json and letting addition processes filter the output (e.g. gotestsum) especially in ci, it seems worth it to use additional tooling to process the results, rather than look at raw logs. |
@seankhliao thanks for the pointers. Nothing I see there particularly changes how I feel about this.
Note that TestMain is only for a single package. This pain is most acute when running across many packages.
Respectfully, I strongly disagree. I don't want to have to pull in additional tools to make my tools usable. This is not an obscure use case. I want my tools to be helpful, out of the box. And I want this locally as well as in CI. This is one of those pain points I've been very frustrated about for ages, and today just happened to be the first day that I realized, "wait, it doesn't have to be like this". |
Having seen some very verbose output in tests with The output here is like asking it to print the test results again, but without -v. |
Running without -v leaves you with limited information on test failure, information that cannot always be regenerated by re-running (think flaky tests). Plus in a CI environment it seems kinda crazy to recommend running both with -v (for debugging details) and without -v (so you can easily tell what is failing).
I think that a list of failing tests, along with the packages they are in, would be quite clear and concise.
Where is this for GitHub Actions? (Where is it in my terminal?) |
#64576 has a similar motivation. I am also frequently annoyed by this. It would save a lot of scrollback time to just list the failing tests briefly at the end. |
Proposal Details
If you run a bunch of tests (
go test -v ./...
), and something goes wrong, the end of the output typically looks like:That final FAIL provides only a single bit of information. You then need to trawl though all the previous output to figure out which test in which package failed. This can be really painful. It's often in CI, which has a poor interface for managing the logs. And grepping isn't necessarily enough. For the output I'm staring at right now, there are 28 matches for "fail", of which only one is relevant.
I propose that on test failure, the go tool print a reprise/summary of failing tests alongside their packages. (Not for json output, of course.) Maybe something like:
Or some such? I'm not particular. All I really want is to be able to instantly tell at a glance what happened, with enough information that subsequent searches through the logs can take me directly to the problem(s).
The text was updated successfully, but these errors were encountered: