Testify v2
Go testing assertions for the rest of us
Info
This is the home of github.com/go-openapi/testify/v2, an active, opinionated fork of github.com/stretchr/testify.
Testify v2 - The v2 our tests wanted
A set of go packages that provide tools for testifying that your code behaves as you intended.
This is the go-openapi fork of the great testify package.
Status
Design and exploration phase. Contributions and proposals are welcome.
Motivation
From the maintainers of testify, it looks like a v2 will eventually be released, but they’ll do it at their own pace.
We like all the principles they put forward to build this v2. See discussion about v2
However, at go-openapi we would like to address the well-known issues in testify with different priorities.
With this fork, we want to:
- remove all external dependencies.
- make it easy to maintain and extend.
- pare down some of the chrome that has been added over the years.
Extended hand
We hope that this endeavor will help the original project with a live-drill of what a v2 could look like. Hopefully, some of our ideas here will eventually percolate back into the original project.
We are always happy to discuss with people who face the same problems as we do: avoid breaking changes, APIs that became bloated over a decade or so, uncontrolled dependencies, difficult choices when it comes to introduce breaking changes, conflicting demands from users etc.
More about our motivations in the project’s README.
Getting started
To use this package in your projects:
… and start writing tests. Look at our examples.
Basic usage
testify simplifies your test assertions like so.
- Standard library
- testify
Licensing
SPDX-FileCopyrightText: Copyright 2025 go-swagger maintainers
This library ships under the SPDX-License-Identifier: Apache-2.0.
See the license NOTICE, which recalls the licensing terms of all the pieces of software distributed with this fork, including internalized libraries.
Contributing
Please feel free to submit issues, fork the repository and send pull requests!
When submitting an issue, we ask that you please include a complete test function that demonstrates the issue. Extra credit for those using Testify to write the test code that demonstrates it.
Info
Code generation is used. Run go generate ./... to update generated files.
See also the CONTRIBUTING guidelines.
Index Of Assertion Domains.
Find the assertion function you need for your data.
- Examples and tutorials.
- Project roadmap, contributing guidelines and maintainer’s guide.
- Example