Skip to content

proposal: testing: print more information about failing tests at the end #71646

@josharian

Description

@josharian

Proposal Details

If you run a bunch of tests (go test -v ./...), and something goes wrong, the end of the output typically looks like:

PASS
ok  	some/package/or/another	0.004s
FAIL

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:

PASS
ok  	some/package/or/another	0.004s
FAIL

FAILING TESTS
    --- FAIL: TestFoo (1.30s)
FAIL	package/with/bug	1.310s
    --- FAIL: TestBar (0.50s)
    --- FAIL: TestBaz/Quxx (0.02s)
FAIL	another/buggy/package	8.310s

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).

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    Status

    Incoming

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions