testify icon indicating copy to clipboard operation
testify copied to clipboard

SetupTest does not run on subtests

Open ahoulgrave opened this issue 5 years ago • 2 comments

Here you can see test failing https://play.golang.org/p/R3m0s_PxwGG

If we call SetupTest() manually inside the subtest works correctly: https://play.golang.org/p/XpsmRqH2F4t

Is this intended behaviour?

ahoulgrave avatar Oct 25 '19 09:10 ahoulgrave

What's the state of this? I'd really use a hook like SetupSubTest or something like this. I use subtests not just for table testing but for documenting each scenario of the function that I'm testing, and thus I end up executing SetupTest on each subtest. Maybe we could implement it in a PR or something?

NefixEstrada avatar Mar 18 '20 08:03 NefixEstrada

duplicate of https://github.com/stretchr/testify/issues/1031

gsagrawal avatar Jun 03 '22 04:06 gsagrawal