CheckOps
Testify
Testify is an MIT-licensed Go toolkit with assert and require assertion packages, mock objects and test suites, the most widely used testing library in the Go ecosystem.
Latest public signals
Not refreshed yet. Refresh reads the public site and, when the entry has a GitHub repository, the latest release.
Introduction
Testify is a set of Go packages that extend the standard testing package, and with about 26,000 GitHub stars it is the most popular Go testing library. It adds readable assertions, mocks and suite support while keeping the standard go test workflow.
The assert package provides functions such as assert.Equal, assert.NoError, assert.Contains, assert.Len and assert.ElementsMatch, printing clear diffs on failure and continuing the test. The require package offers the same functions but stops the test immediately, useful when later steps depend on earlier ones. The mock package lets you build mock objects by embedding mock.Mock, setting expectations with On(...).Return(...) and verifying with AssertExpectations; the separate mockery tool can generate these mocks from interfaces. The suite package supports struct-based suites with setup and teardown methods. Version 1.12.1 was released on 19 August 2026.
The source code is at stretchr/testify on GitHub under the MIT licence, with about 26,200 stars; the most recent commit was on 9 November 2026.
Features
- Readable assertions:
assertandrequirewith clear diffs. - Mocks:
mock.Mockwith expectations and argument matchers. - Suites: Setup and teardown around grouped tests.
- Standard workflow: Runs with plain
go test.
Pros
- Free to use: Open source under the MIT licence, so the core tool costs nothing to use.
- Actively maintained: The repository had commits as recent as 9 November 2026.
- Community: About 26,200 GitHub stars.
Cons
- Non-idiomatic for some: Some Go developers prefer plain
ifchecks or go-cmp. - Manual mocks: Mocks are verbose without a generator such as mockery.
Usage and Links (Example)
import (
"testing"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
func TestCreateOrder(t *testing.T) {
order, err := CreateOrder([]Item{{SKU: "A", Qty: 2}})
require.NoError(t, err)
assert.Equal(t, 2, order.Items[0].Qty)
assert.NotEmpty(t, order.ID)
}
Resources:
Pricing
Testify is free and open source under the MIT licence.
Recommended for?
- Go teams wanting concise assertions and simple mocks.
- Developers coming from xUnit-style frameworks.
Conclusion
Testify is the most widely used Go testing library, adding readable assertions, mocks and suites on top of the standard toolchain.
Alternatives
Other tools on CheckOps that cover similar ground. Open a page, or compare one with Testify side by side.
GGo testing packageGo's built-in testing package and go test command provide unit tests, table-driven subtests, benchmarks, fuzzing, examples and coverage with no third-party dependencies.Compare with Testify
GGoMock (uber-go/mock)GoMock is an Apache-2.0 mocking framework for Go, maintained by Uber after the original golang/mock was archived, with the mockgen code generator and a gomock controller for expectations.Compare with Testify
GGinkgoGinkgo is an MIT-licensed BDD-style testing framework for Go with Describe/Context/It specs, parallel execution, focused and labelled specs and rich reporting, usually paired with the Gomega matcher library.Compare with Testify
GGomegaGomega is an MIT-licensed matcher and assertion library for Go, designed for Ginkgo but usable with plain go test, with asynchronous Eventually/Consistently assertions.Compare with Testify
RRapidRapid is an MPL-2.0 property-based testing library for Go, inspired by Hypothesis, with automatic shrinking, state machine testing and integration with go test.Compare with Testify
TTestcontainersTestcontainers starts throwaway Docker containers from tests so integration tests can use real databases, brokers, and browsers.Compare with Testify