On this page
Overview
Testify is a testing toolkit designed to work with Go's standard testing package. It provides readable assertions through assert, fail-fast helpers through require, interface-oriented mocks through mock, and shared setup or teardown through suite.
Features and best fit
Based on official documentation; not hands-on tested · Content checked:
Key features
Write concise checks with assert and fail-fast preconditions with require
assert records failures on testing.T and returns a bool so tests can decide whether to continue. require offers similar APIs but terminates the current test immediately on failure.
Sources: [2]
Use mocks and suites to isolate dependencies and share setup
mock.Mock defines method expectations and return values so tests can verify dependency interactions. The suite package groups setup, teardown, and shared state across related tests.
Sources: [2]
Best fit
Fits Go projects that want clearer assertions and mocks without replacing go test
It can be added incrementally to existing testing.T tests and is useful for unit and service-layer tests that benefit from readable expectations and dependency mocks.
Sources: [2]
Before adoption
v1.12.1 declares Go 1.17 minimum and Testify v1 is maintained without breaking changes
The v1.12.1 go.mod declares Go 1.17 as the tested minimum, while the README states that v1 will not accept breaking changes. The release also reduces the remaining dependency set. Because require uses FailNow, it must be called from the test or benchmark goroutine rather than helper goroutines.
Official sources
- [1]stretchr/testify — GitHub repository(2026-10-06)
- [2]Testify v1.12.1 — README(2026-10-06)
- [3]Testify v1.12.1 — go.mod(2026-10-06)
- [4]Testify v1.12.1 release(2026-10-06)
- [5]Testify MIT license(2026-10-06)
Supplemental curator note
Testify augments rather than replaces Go's standard testing package, making it easy to adopt incrementally. Because require terminates the current test via FailNow, do not call it from helper goroutines outside the test or benchmark goroutine.
Try it in 3 steps
- 1
Get the source
git clone --depth 1 https://github.com/stretchr/testify.git - 2
Enter the repository
cd testify - 3
Check the official steps
Continue with the commands in the README Installation, Quick Start, or Getting Started section.
find . -maxdepth 1 -iname 'README*' -exec sed -n '1,220p' {} \; -quit
Growth
Growth trends · Last 30 days
26,222 Stars
Trend data is still being collected.
Development activity
Last 90 days · weekly
- Commits (last 30 days)
- 2
- Open PRs
- 162
Development activity is still being collected.
Built with
Categories and tags
Categories
GitHub data
GitHub dataView detailed GitHub data
GitHub Topics
- testify
- go
- assertions
- mocking
- golang
- testing
- toolkit
Related information
Write a related articleShare a guide or use case for this OSS in Markdown. Articles are published after administrator approval.
Explore next
- The Composable Architecture14,952 Stars
2 shared tag(s) · 2 shared category(s)
build composable SwiftUI and UIKit features around State, Action, Reducer, and Store
Swift - Quick9,825 Stars
2 shared tag(s) · 2 shared category(s)
organize Swift and Objective-C tests as BDD specifications with describe, context, and it
Swift - JUnit7,057 Stars
2 shared tag(s) · 2 shared category(s)
Java/JVM testing built on Platform and Jupiter
Java - Robolectric6,061 Stars
2 shared tag(s) · 2 shared category(s)
run Android unit tests on the JVM without starting a device or emulator
Java - MockK5,762 Stars
2 shared tag(s) · 2 shared category(s)
mock, stub, and verify Kotlin collaborators with coroutine and Android support
Kotlin - RSpec Rails5,276 Stars
2 shared tag(s) · 2 shared category(s)
Describe and verify Rails models, HTTP responses, and browser behavior as specs
Ruby
Report incorrect information
Tell us if any listing information is incorrect or outdated.