Skip to content
Discussion options

You must be logged in to vote

To add to what hemflit said, you can absolutely mix assert.Equal() / require.NoError() with the suite package. The suite's assert and require methods are just convenience wrappers that automatically bind the test's *testing.T so you don't have to pass it each time. Functionally equivalent.

For t.Run() vs suite.Run(): you can use suite.T().Run() just fine. The suite doesn't override the behavior of t.Run(), it just provides hooks (SetupTest, TearDownTest, BeforeTest, AfterTest) that fire around the suite's own test methods. If you call t.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 …

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by chancez
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants