What problem does it solve?
It helps you write reliable, readable Go tests by showing the correct way to use stretchr/testify for assertions, fail-fast checks, mocking, and suites.
Core Features & Use Cases
- assert vs require discipline: Use assert for non-critical verifications and require for preconditions to avoid nil-panics and misleading failures.
- Advanced assertions: Cover equality, error-chain checks (ErrorIs/ErrorAs), JSONEq, Eventually polling (including EventuallyWithT), and more.
- testify/mock and suite patterns: Build mocks with expectations, match arguments with mock.Anything / mock.AnythingOfType / mock.MatchedBy, verify with AssertExpectations, and structure tests with suite.Suite lifecycles.
Use case example: You are writing a Go handler test that needs to (1) stop immediately when input parsing fails, (2) verify structured JSON output ignoring key order, and (3) mock a dependency where the same method is called with retry/failure sequences.
Quick Start
Use this skill when your codebase imports github.com/stretchr/testify and you want to apply correct patterns for assertions, mocks, and suite lifecycle.