Skip to content
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

testing: allow creation of subtests #9268

cflewis opened this issue Dec 11, 2014 · 3 comments

testing: allow creation of subtests #9268

cflewis opened this issue Dec 11, 2014 · 3 comments


Copy link

cflewis commented Dec 11, 2014

Problem: When writing tests that take >3 minutes each, the tests should be parallelized. If your tests are also amenable to being written in a table-driven format, you have to resort to goroutines to make things parallel (rather than t.Parallel()). If you do that, then your logs get interleaved, and go test run .* can't help you out to isolate particular failures, and you lose the benefits of t.Parallel(), like setting number of parallel lines at CLI, ensuring non-parallel ones don't run with it...

Solution: A proposed solution discussed involves the ability for tests to create their own subtests.

Copy link

ianlancetaylor commented Dec 11, 2014

Marcel said he is working on something along these lines.

Copy link

neild commented Dec 11, 2014

It's also easy enough to convert a table-driven test into a set of individual tests, along the lines of:

type testFoo struct {...}
func (test testFoo) Test(t *testing.T) { ... }
func TestFooA(t *testing.T) {

@rsc rsc added this to the Unplanned milestone Apr 10, 2015
@rsc rsc changed the title Table-driven testing for parallel integration tests hurts testing: allow creation of subtests Apr 14, 2015
Copy link

adg commented Oct 21, 2015

Closing in favor of #12166

@adg adg closed this as completed Oct 21, 2015
@golang golang locked and limited conversation to collaborators Oct 24, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
None yet

No branches or pull requests

6 participants