proposal: testing: export test/benchmark name #16901
Closed
Labels
Milestone
Comments
I feel like this is solving the wrong problem; the TB already knows which subtest it is for, maybe the log output should just be changed to prepend every log message with the name of the test? Also the hypothetical JSON output (#2981) separates log messages by test. |
That is only helpful for logs that go through |
Fixed in #17231. |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
This is a proposal to add a
Name() string
function totesting.TB
that returns the name of the test/benchmark. This is necessary to differentiate between debugging messages, events, traces etc when running tests/benchmarks in parallel.In many cases one can figure out the enclosing
Test..
function by studying the caller stack but that wouldn't work for subtests. This feature would be especially useful when the subtests are generated programatically, e.g.for i := 1; i <= 5; i++ { t.Run(fmt.Sprintf("i=%d", i), ..)
The text was updated successfully, but these errors were encountered: