-
Notifications
You must be signed in to change notification settings - Fork 18.4k
Description
Background
There have been several requests in the past for a summary in the end of a test suite run:
- proposal: cmd/go: go test summary #27755 - proposal: cmd/go: go test summary
- cmd/go: add summary at end of go test results #30507 - cmd/go: add summary at end of go test results
- proposal: testing: re-print failed test names before exiting #41748 - proposal: testing: re-print failed test names before exiting
All these requests have been denied as it isn't clear which summary style/format would clearly be beneficial.
The proposed workaround was to run the tests with -json and to use the output to generate a suitable summary.
For instance gotestsum provides just that but it is an external tool and so developers and automation need to diverge from their usual workflow in order to utilize gotestsum.
Proposal
Add test stats to testing.M so that TestMain can print a custom test results summary after m.Run().
The test stats should include:
- List of all tests.
- List of all examples.
- List of all benchmarks.
- List of successful tests.
- List of successful examples.
- List of successful benchmarks.
- List of skipped tests.
- List of skipped examples (in case of -failfast).
- List of skipped benchmarks (in case tests or examples failed).
- List of failed tests.
- List of failed examples.
- List of failed benchmarks.
This could be done by enhancing the runTests, runExamples and runBenchmarks functions to produce these lists.
All lists would be of type []InternalTest, []InternalExample or []InternalBenchmark.
Metadata
Metadata
Assignees
Labels
Type
Projects
Status