The current docs say:
Name returns the name of the running test or benchmark.
For a func TestFoo(t *testing.T), I think it's reasonably clear that Name will be TestFoo.
However, for a sub-test like t.Run("Bar", ...), it's not clear from the documentation if Name will return TestFoo/Bar or just TestFoo.
Another open question is whether the name will be altered, just like it is when printing output. For example, t.Run("bar baz", ...) ends up printing TestFoo/bar_baz in the terminal, so if the subtest name is included in the Name method, I'm not sure which of the two I'd expect.
cc @mpvl as per the owners doc
cc @adg @bradfitz since they added the Name method
The current docs say:
For a
func TestFoo(t *testing.T), I think it's reasonably clear that Name will beTestFoo.However, for a sub-test like
t.Run("Bar", ...), it's not clear from the documentation if Name will returnTestFoo/Baror justTestFoo.Another open question is whether the name will be altered, just like it is when printing output. For example,
t.Run("bar baz", ...)ends up printingTestFoo/bar_bazin the terminal, so if the subtest name is included in the Name method, I'm not sure which of the two I'd expect.cc @mpvl as per the owners doc
cc @adg @bradfitz since they added the Name method