Comprehensive guide to stretchr/testify for Golang testing. Covers assert, require, mock, and suite packages in depth. Use whenever writing tests with testify, creating mocks, setting up test suites, or choosing between assert and require. Essential for testify assertions, mock expectations, argument matchers, call verification, suite lifecycle, and advanced patterns like Eventually, JSONEq, and custom matchers. Trigger on any Go test file importing testify.
92
93%
Does it follow best practices?
Impact
90%
1.30xAverage score across 3 eval scenarios
Passed
No known issues
assert.New usage
0%
100%
require.New usage
0%
100%
Named `is`
0%
100%
Named `must`
0%
100%
require for error checks
80%
100%
require for nil guards
80%
100%
assert for value checks
100%
100%
ErrorIs for sentinel errors
40%
100%
Correct argument order
100%
100%
testing.T entry point
100%
100%
ErrorContains or ErrorAs
80%
0%
Embed mock.Mock
100%
100%
m.Called() in methods
100%
100%
AssertExpectations called
58%
66%
mock.Anything used appropriately
50%
100%
Specific matcher for email
100%
100%
Once/Times call modifier
100%
100%
Retry scenario uses chained Once()
100%
100%
AssertNotCalled usage
100%
100%
assert.New / require.New naming
0%
0%
require for error precondition
100%
100%
No extra mock.Mock field
100%
100%
Run side-effect used
0%
0%
suite.Suite embedded
100%
100%
Launcher function present
100%
100%
SetupTest initializes mock
100%
100%
SetupTest rebuilds service
100%
100%
AssertExpectations in tests
100%
100%
s.Require() for guards
0%
100%
Suite assertions for verifications
100%
100%
SetupSuite used appropriately
100%
100%
TearDownTest or TearDownSuite
0%
100%
Test method naming
100%
100%
mock.Anything for context
0%
100%
No missing launcher silent pass
100%
100%
b88f91d
Table of Contents
If you maintain this skill, you can claim it as your own. Once claimed, you can manage eval scenarios, bundle related skills, attach documentation or rules, and ensure cross-agent compatibility.