Comprehensive guide to stretchr/testify for Golang testing. Covers assert, require, mock, and suite packages in depth. Use when writing tests with testify, creating mocks, setting up test suites, or choosing between assert and require. Covers testify assertions, mock expectations, argument matchers, call verification, suite lifecycle, and advanced patterns like Eventually, JSONEq, and custom matchers. Apply when the codebase imports github.com/stretchr/testify.
88
89%
Does it follow best practices?
Impact
81%
1.92xAverage score across 3 eval scenarios
Passed
No findings from the security scan
Mock call modifiers and detailed verification in retry tests
These are not visible to scoring or included in the download.
/home/agent/go/pkg/mod/cache/download/github.com/stretchr/objx/@v/list
/home/agent/go/pkg/mod/cache/download/github.com/stretchr/objx/@v/v0.5.3.info
/home/agent/go/pkg/mod/cache/download/github.com/stretchr/objx/@v/v0.5.3.lock
/home/agent/go/pkg/mod/cache/download/github.com/stretchr/objx/@v/v0.5.3.mod
/home/agent/go/pkg/mod/cache/download/github.com/stretchr/objx/@v/v0.5.3.zip
These are not visible to scoring or included in the download.
/home/agent/go/pkg/mod/cache/download/github.com/davecgh/go-spew/@v/list
/home/agent/go/pkg/mod/cache/download/github.com/davecgh/go-spew/@v/v1.1.1.info
/home/agent/go/pkg/mod/cache/download/github.com/davecgh/go-spew/@v/v1.1.1.lock
/home/agent/go/pkg/mod/cache/download/github.com/davecgh/go-spew/@v/v1.1.1.mod
/home/agent/go/pkg/mod/cache/download/github.com/davecgh/go-spew/@v/v1.1.1.zip
Mock embedding
100%
100%
Chained Once expectations
100%
100%
Run side effect
0%
100%
AssertNumberOfCalls
100%
100%
AssertNotCalled
0%
100%
AssertExpectations on Fetcher
100%
100%
AssertExpectations on Logger
100%
100%
mock.Anything usage
100%
100%
is naming
0%
100%
must naming
0%
0%
Specialised testify assertions for mixed output types
These are not visible to scoring or included in the download.
/home/agent/go/pkg/mod/cache/download/github.com/stretchr/testify/@v/list
/home/agent/go/pkg/mod/cache/download/github.com/stretchr/testify/@v/v1.12.1.info
/home/agent/go/pkg/mod/cache/download/github.com/stretchr/testify/@v/v1.12.1.lock
/home/agent/go/pkg/mod/cache/download/github.com/stretchr/testify/@v/v1.12.1.mod
/home/agent/go/pkg/mod/cache/download/github.com/stretchr/testify/@v/v1.12.1.zip
ElementsMatch for IDs
0%
100%
InDelta for rating
0%
100%
JSONEq for summary
0%
0%
Regexp for RequestID
0%
100%
Named assert wrapper
0%
100%
Named require wrapper
0%
100%
Require for error precondition
0%
100%
Expected-first argument order
0%
100%
Error hierarchy testing with ErrorIs, ErrorAs, ErrorContains
These are not visible to scoring or included in the download.
/home/agent/go/pkg/mod/cache/download/github.com/stretchr/testify/@v/list
/home/agent/go/pkg/mod/cache/download/github.com/stretchr/testify/@v/v1.12.1.info
/home/agent/go/pkg/mod/cache/download/github.com/stretchr/testify/@v/v1.12.1.lock
/home/agent/go/pkg/mod/cache/download/github.com/stretchr/testify/@v/v1.12.1.mod
/home/agent/go/pkg/mod/cache/download/github.com/stretchr/testify/@v/v1.12.1.zip
These are not visible to scoring or included in the download.
/home/agent/go/pkg/mod/cache/download/github.com/stretchr/testify/@v/list
/home/agent/go/pkg/mod/cache/download/github.com/stretchr/testify/@v/v1.12.1.info
/home/agent/go/pkg/mod/cache/download/github.com/stretchr/testify/@v/v1.12.1.lock
/home/agent/go/pkg/mod/cache/download/github.com/stretchr/testify/@v/v1.12.1.mod
/home/agent/go/pkg/mod/cache/download/github.com/stretchr/testify/@v/v1.12.1.zip
ErrorIs for sentinel
58%
100%
No Equal for wrapped error
100%
100%
ErrorAs for type extraction
91%
100%
must.ErrorAs as precondition
90%
100%
Field inspection after ErrorAs
100%
100%
ErrorContains for message substring
41%
16%
require for preconditions
100%
100%
is := assert.New(t)
0%
0%
must := require.New(t)
0%
0%
Argument order (expected, actual)
100%
50%
19a0626
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.