⚠ This page is served via a proxy. Original site: https://github.com
This service does not collect credentials or authentication data.
Skip to content

go-openapi/testify

 
 

Testify/v2

Tests Coverage CI vuln scan CodeQL

Release Go Report Card CodeFactor Grade License

Doc GoDoc Discord Channel go version Top language Commits since latest release


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.

Note

This is the home of github.com/go-openapi/testify/v2, an active, opinionated fork of github.com/stretchr/testify.

Main features:

Announcements

  • 2025-12-19 : new community chat on discord
    • a new discord community channel is available to be notified of changes and support users
    • our venerable Slack channel remains open, and will be eventually discontinued on 2026-03-31

You may join the discord community by clicking the invite link on the discord badge (also above). Discord Channel

Or join our Slack channel: Slack Channelslack-badge

Status

Design and exploration phase. Contributions and proposals are welcome.

Recent news Fully refactored how assertions are generated and documented. Fixed hangs & panics when using spew. Fuzzed spew. Fixed go routine leaks with EventuallyWithT and co. Added Kind & NotKind Fix deterministic order of keys in diff Fixed edge cases with InDelta, InEpsilon Added opt-in support for colorized output Introduced generics (round 1): 16 new type-safe assertions with generic types (added benchmark)

See our ROADMAP.

Import this library in your project

go get github.com/go-openapi/testify/v2

Basic usage

testify simplifies your test assertions like so.

    import (
        "testing"
    )
    ...
    
    const expected = "expected result"

	result := printImports(input)
	if result != expected {
		t.Errorf(
            "Expected: %s. Got: %s", expected, result, 
        )

        return
	}

Becomes:

    import (
        "testing"
        "github.com/go-openapi/testify/v2/require"
    )
    ...

    const expected = "expected result"

	require.Equalf(t,
        expected, printImports(input), "Expected: %s. Got: %s",
        expected, result, 
    )

Usage at go-openapi and go-swagger

This fork now fully replaces the original project for all go-openapi projects, thus reducing their dependencies footprint.

Go-swagger will be adapted over Q1 2026.

Features will probably be added to support our main use cases there.

Change log

See https://github.com/go-openapi/testify/releases

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.

Other documentation

Cutting a new release

Maintainers can cut a new release by either:

  • running this workflow (recommended)
  • or :
    1. preparing go.mod files with the next tag, merge
    2. pushing a semver tag
    • signed tags are preferred
    • The tag message is prepended to release notes

About

Zero-dependency assertions library

Resources

License

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Go 96.3%
  • Go Template 3.2%
  • Other 0.5%