How stretchr/testify works
Testify is a Go testing-support library: test authors use assertions to check outcomes, and can choose immediate-failure requirements, expectation-based mocks, or structured suites. Assertions also provide specialized HTTP and YAML checks; internal formatting and diff utilities support readable failures. The suite runner manages test methods, subtests, and setup/teardown hooks. Edges reflect only relationships shown in the README or sampled source references; mock internals and HTTP helper wiring were not sampled, so no internal call flow is inferred for them.
Main entry points: assertions.go Assertions · suite.go Suite execution · require.go Fail-fast checks · mock.go Mock expectations
Components 9
Assertion APIs
- Assertions
assert/assertions.go - Fail-fast checks
require/require.go
Test Doubles
- Mock expectations
mock/mock.go - HTTP test helpers
http/test_response_writer.go
Suite Runner
- Suite execution
suite/suite.go
Assertion Support
- YAML comparison
assert/yaml/yaml_default.go - Text diffs
internal/difflib/difflib.go - Value formatting
internal/spew/dump.go
Other components
- Test author
Connections 10
- Test author → Assertions: checks outcomes
README.md - Test author → Fail-fast checks: checks or aborts
README.md - Test author → Mock expectations: sets expectations
README.md - Test author → Suite execution: runs suite
README.md - Fail-fast checks → Assertions: delegates checks
require/require.go - Suite execution → Assertions: provides context
suite/suite.go - Suite execution → Fail-fast checks: provides context
suite/suite.go - Assertions → YAML comparison: compares YAML
assert/assertions.go - Assertions → Text diffs: builds diffs
assert/assertions.go - Assertions → Value formatting: formats values
assert/assertions.go