|
I've got a bunch of code I think could benefit from using the suite package, but I loath updating everything that's currently using Another case I have is I already had some reuse going on with some helper funcs that just took a Are there any trade-offs to be concerned with by not using the suite methods, and only using the suite to handle common test setup and such? |
Replies: 2 comments
|
If you don't actively change the
Yes, as long as the subtest is using the |
|
To add to what hemflit said, you can absolutely mix For The practical tradeoff:
Mixing both is fine, just be aware of which lifecycle hooks you're opting out of when you use |
To add to what hemflit said, you can absolutely mix
assert.Equal()/require.NoError()with the suite package. The suite'sassertandrequiremethods are just convenience wrappers that automatically bind the test's*testing.Tso you don't have to pass it each time. Functionally equivalent.For
t.Run()vssuite.Run(): you can usesuite.T().Run()just fine. The suite doesn't override the behavior oft.Run(), it just provides hooks (SetupTest,TearDownTest,BeforeTest,AfterTest) that fire around the suite's own test methods. If you callt.Run()directly inside a suite test method, those hooks won't fire for sub-tests created that way, which might surprise you if you're relying on them.The …