Testing Frameworks

74 projects

Go's built-in testing package covers unit tests, subtests with t.Run, parallel tests, benchmarks, examples and, since Go 1.18, native fuzzing with go test -fuzz. Table-driven tests with plain if checks are the common style. The libraries here add assertions, behavior-driven frameworks, helpers for integration tests with real services, HTTP API testing, and tools for test output and coverage.

stretchr/testify is the most used testing library, providing assert and require helpers, suites and a mock package. google/go-cmp compares values and prints readable diffs, and is often used without any other library. matryer/is offers minimal assertions. For behavior-driven development, Ginkgo with its Gomega matchers structures specs with Describe and It blocks, and godog runs Cucumber feature files. GoConvey adds a web UI but has been quiet since 2024. testcontainers-go starts Docker containers for databases and other dependencies, and gnomock and embedded-postgres solve the same problem differently. httpexpect tests HTTP APIs end to end, go-vcr records and replays HTTP, and keploy generates tests from recorded API traffic.

Start with the standard testing package and go-cmp for comparisons; add testify if your team prefers assertion helpers. Use Ginkgo only if BDD-style specs fit how your team writes requirements. For integration tests, testcontainers-go gives realistic results with little setup. Run tests with the -race flag in CI, since data races are a common source of flaky failures in concurrent Go code.

Testifyby stretchr

Sacred extension to the standard go testing package.

github.com/stretchr/testifyGo 1.17+ 2 dependenciesv1.12.1updated today

26.2k

keploy

Generate Testcase and Data Mocks from API calls automatically.

go.keploy.io/server/v3Go 1.27+ 63 dependenciesv3.6.208updated today

19.1k

GoConveyby smartystreets

BDD-style framework with web UI and live reload.

github.com/smartystreets/goconveyGo 1.21+ 3 dependenciesv1.8.0updated 2y ago

8.4k

testcontainers-goby testcontainers

A Go package that makes it simple to create and clean up container-based dependencies for automated integration/smoke tests. The clean, easy-to-use API enables developers to programmatically define containers that should be run as part of a test and clean up those resources when the test is done.

github.com/testcontainers/testcontainers-goGo 1.26+ 16 dependenciesv0.44.0updated today

5k

go-cmpby google

Package for comparing Go values in tests.

github.com/google/go-cmpGo 1.21+ No dependencies v0.7.0updated 4d ago

4.7k

httpexpectby gavv

Concise, declarative, and easy to use end-to-end HTTP and REST API testing.

github.com/gavv/httpexpect/v2Go 1.19+ 19 dependenciesv2.17.0updated 11mo ago

2.7k

godogby cucumber

Cucumber BDD framework for Go.

github.com/cucumber/godogGo 1.18+ 6 dependenciesv0.16.0updated 10d ago

2.7k

isby matryer

Professional lightweight testing mini-framework for Go.

github.com/matryer/isGo 1.14+ No dependencies v1.4.1updated 2y ago

2k

gnomockby orlangure

Integration testing with real dependencies (database, cache, even Kubernetes or AWS) running in Docker, without mocks.

github.com/orlangure/gnomockGo 1.24+ 33 dependenciesv0.32.0updated 6mo ago

1.5k

go-vcrby dnaeon

Record and replay your HTTP interactions for fast, deterministic and accurate tests.

gopkg.in/dnaeon/go-vcr.v4Go 1.24+ 1 dependencyv4.0.7updated today

1.4k

tparseby mfridman

CLI tool for summarizing go test output. Pipe friendly. Compatible with go test flags.

github.com/mfridman/tparseGo 1.23+ 4 dependenciesv0.18.0updated 11mo ago

1.3k

embedded-postgresby fergusstrange

Run a real Postgres database locally on Linux, OSX or Windows as part of another Go application or test.

github.com/fergusstrange/embedded-postgres/v2Go 1.26+ No dependencies v2.0.1updated 6d ago

1.3k

testfixturesby go-testfixtures

A helper for Rails' like test fixtures to test database applications.

github.com/go-testfixtures/testfixtures/v3Go 1.25+ 2 dependenciesv3.19.0updated 13d ago

1.2k

go-httpbinby mccutchen

HTTP testing and debugging tool with various endpoints for client testing.

github.com/mccutchen/go-httpbin/v2Go 1.26+ No dependencies v2.26.0updated 18d ago

893

goblinby franela

Mocha like testing framework of Go.

github.com/franela/goblinGo 1.14+ No dependencies 0.0.2updated 3y ago

885

gocby qiniu

Goc is a comprehensive coverage testing system for The Go Programming Language.

github.com/qiniu/gocGo 1.13+ 17 dependenciesv1.4.5updated 6mo ago

873

balooby h2non

Expressive and versatile end-to-end HTTP API testing made easy.

v3.1.0updated 4y ago

778

gotest.toolsby gotestyourself

A collection of packages to augment the go testing package and support common patterns.

gotest.tools/v3Go 1.17+ 2 dependenciesv3.5.2updated 1mo ago

576

go-testdeepby maxatome

Extremely flexible golang deep comparison, extends the go testing package.

github.com/maxatome/go-testdeepGo 1.18+ No dependencies v1.16.0updated 1mo ago

464

gofightby appleboy

API Handler Testing for Golang Router framework.

github.com/appleboy/gofight/v2Go 1.26+ 1 dependencyv2.2.3updated 1mo ago

445

testzaby MarvinJWendt

Full-featured test framework with nice colorized output.

github.com/MarvinJWendt/testzaGo 1.18+ 5 dependenciesv0.5.2updated 3y ago

416

cupaloyby bradleyjkemp

Simple snapshot testing addon for your test framework.

github.com/bradleyjkemp/cupaloy/v23 dependenciesv2.8.0updated 3y ago

333

arch-go

Architecture testing tool for Go projects.

github.com/arch-go/arch-go/v2Go 1.24+ 9 dependenciesv2.1.2updated 12d ago

283

frisbyby verdverm

REST API testing framework.

updated 6y ago

274

go-snapsby gkampitakis

Jest-like snapshot testing in Golang.

github.com/gkampitakis/go-snapsGo 1.23+ 8 dependenciesv0.5.25updated 6d ago

270

endlyby viant

Declarative end to end functional testing.

github.com/viant/endlyGo 1.25+ 67 dependenciesv0.96.0updated today

269

gotby ysmood

An enjoyable golang test framework.

github.com/ysmood/gotGo 1.21+ 1 dependencyv0.43.0updated 4mo ago

265

go-hitby Eun

Hit is an http integration test framework written in golang.

github.com/Eun/go-hitGo 1.15+ 18 dependenciesv0.5.23updated 2y ago

255

go-carpetby msoap

Tool for viewing test coverage in terminal.

github.com/msoap/go-carpetGo 1.19+ 5 dependenciesv1.10.0updated 1y ago

250

go-test-coverageby vladopajic

Tool that reports coverage of files below set threshold.

github.com/vladopajic/go-test-coverage/v2Go 1.27+ 11 dependenciesv2.21.0updated 3d ago

242

commanderby SimonBaeumer

Tool for testing cli applications on windows, linux and osx.

github.com/commander-cli/commander/v2Go 1.21+ 11 dependenciesv2.5.0updated 2y ago

232

charlatanby percolate

Tool to generate fake interface implementations for tests.

v1.0.5updated 2y ago

205

Testoby ozontech

Plugin-based testing framework with suites, parallel tests, hooks and parametrization. Inspired by Pytest.

github.com/ozontech/testoGo 1.25+ No dependencies v1.9.0updated 11d ago

188

dbcleanerby khaiql

Clean database for testing purpose, inspired by database_cleaner in Ruby.

v2.3.0updated 4y ago

163

jsonassertby kinbiko

Package for verifying that your JSON payloads are serialized correctly.

github.com/kinbiko/jsonassertGo 1.27+ No dependencies v1.2.0updated 1mo ago

145

beby carlmjohnson

The minimalist generic test assertion library.

github.com/carlmjohnson/beGo 1.23+ No dependencies v0.25.2updated 1y ago

133

testcaseby adamluzsi

Idiomatic testing framework for Behavior Driven Development.

go.llib.dev/testcaseGo 1.18+ No dependencies v0.145.0updated today

133

gocrestby corbym

Composable hamcrest-like matchers for Go assertions.

github.com/corbym/gocrestGo 1.18+ No dependencies v1.3.0updated 1mo ago

107

wstestby posener

Websocket client for unit-testing a websocket http.Handler.

github.com/posener/wstestGo 1.13+ 2 dependenciesv1.2.0updated 5y ago

102

gherkingenby hedhyw

BDD boilerplate generator and framework.

github.com/hedhyw/gherkingen/v4Go 1.25+ 6 dependenciesv4.1.1updated 1d ago

99

testcertsby madflojo

Dynamically generate self-signed certificates and certificate authorities within your test functions.

github.com/madflojo/testcertsGo 1.20+ No dependencies v1.5.1updated today

84

assertby go-playground

Basic Assertion Library used along side native go testing, with building blocks for custom assertions.

github.com/go-playground/assert/v2Go 1.13+ No dependencies v2.2.0updated 4y ago

67

restitby yookoala

Go micro framework to help writing RESTful API integration test.

github.com/go-restit/restitGo 1.18+ 2 dependenciesupdated 4mo ago

54

gospecifyby stesla

This provides a BDD syntax for testing your Go code. It should be familiar to anybody who has used libraries such as rspec.

updated 15y ago

52

shouldby Kairum-Labs

Testing library with zero dependencies, detailed struct diffs and human-readable error messages.

github.com/Kairum-Labs/shouldGo 1.22+ No dependencies v0.3.0updated 2mo ago

48

dsunitby viant

Datastore testing for SQL, NoSQL, structured files.

github.com/viant/dsunitGo 1.22+ 20 dependenciesv0.15.0updated 20d ago

47

gomatchby jfilipczyk

Library created for testing JSON against patterns.

github.com/jfilipczyk/gomatchGo 1.15+ 2 dependenciesv1.2.1updated 5y ago

47

fixenvby rekby

Fixture manage engine, inspired by pytest fixtures.

github.com/rekby/fixenvGo 1.18+ No dependencies v0.7.1updated 1y ago

35

axiomby Nikita-Filonov

Composable Go test framework with fixtures, hooks, retries, metadata, plugins, and parallel execution.

github.com/Nikita-Filonov/axiomGo 1.26+ 1 dependencyv1.20.0updated 2d ago

32

Hamcrestby rdrdr

Fluent framework for declarative Matcher objects that, when applied to input values, produce self-describing results.

updated 5y ago

30

fluteby suzuki-shunsuke

HTTP client testing framework.

github.com/suzuki-shunsuke/flute/v2Go 1.25+ 3 dependenciesv2.0.0updated today

23

schemaby jgroeneveld

Quick and easy expression matching for JSON schemas used in requests and responses.

updated 7y ago

20

dftby abecodes

Lightweight, zero dependency docker containers for testing (or more).

github.com/abecodes/dftGo 1.22+ No dependencies v0.0.3updated 1y ago

19

gogivenby corbym

YATSPEC-like BDD testing framework for Go.

github.com/corbym/gogivenGo 1.22+ 2 dependenciesv1.5.0updated 6mo ago

17

testsqlby zhulongcheng

Generate test data from SQL files before testing and clear it after finished.

updated 7y ago

17

biffby fulldump

Bifurcation testing framework, BDD compatible.

github.com/fulldump/biffGo 1.14+ No dependencies v1.2.1updated 3y ago

14

stop-and-goby elgohr

Testing helper for concurrency.

github.com/elgohr/stop-and-goGo 1.18+ 1 dependencyupdated 2mo ago

13

gosuiteby pavlo

Brings lightweight test suites with setup/teardown facilities to testing by leveraging Go1.7's Subtests.

updated 10y ago

12

Ttby vcaesar

Simple and colorful test tools.

github.com/vcaesar/ttGo 1.17+ No dependencies v0.40.0updated 1mo ago

10

go-testpredicateby maargenton

Test predicate style assertions library with extensive diagnostics output.

github.com/maargenton/go-testpredicateGo 1.24+ 1 dependencyv1.7.0updated 1mo ago

7

go-mutestingby jonbaldie

Mutation testing for Go with CI quality gates, coverage-aware MSI, baseline tracking, and git-diff filtering.

github.com/jonbaldie/go-mutesting/v2Go 1.26+ 6 dependenciesv2.10.40updated 6d ago

6

go-testingby tkrop

Go testing extension, that allows a simple setup of strongly isolated unit, component, and integration test providing advanced mock support extending gomock and gock.

github.com/tkrop/go-testingGo 1.27+ 8 dependenciesv0.2.0updated 3d ago

6

trialby jgroeneveld

Quick and easy extendable assertions without introducing much boilerplate.

github.com/jgroeneveld/trialGo 1.19+ 1 dependencyupdated 4y ago

6

assayby tushariitr-19

Framework-agnostic evaluation library for testing Go agents and MCP servers with deterministic checks, CI-ready exit codes, and zero-code YAML-based testing.

github.com/tushariitr-19/assayGo 1.25+ 2 dependenciesupdated 4mo ago

5

enviteby PerimeterX

Dev and testing environment management framework.

github.com/perimeterx/enviteGo 1.25+ 11 dependenciesv0.0.13updated 4mo ago

5

go-mysql-test-containerby arikama

Golang MySQL testcontainer to help with MySQL integration testing.

github.com/arikama/go-mysql-test-containerGo 1.18+ 4 dependenciesv1.4.0updated 4y ago

3

prettycovby screwyprof

Draws a Go coverage profile as a package tree with a total on every row.

github.com/screwyprof/prettycovGo 1.26+ 5 dependenciesv0.17.0updated 5d ago

3

coverageby jbunds

A simple Web UI for Go test coverage, and the go-test-coverage-html-report reusable GitHub Action.

github.com/jbunds/coverageGo 1.27+ 7 dependenciesv1.0.94updated 4d ago

2

httperby gustofarbi

CLI runner for JetBrains.http files with scripting, assertions, gRPC, and load testing.

github.com/gustofarbi/httperGo 1.25+ 8 dependenciesv0.1.0updated 4mo ago

1

omg.testingtoolsby dedalqq

The simple library for change a values of private fields for testing.

github.com/dedalqq/omg.testingtoolsGo 1.17+ No dependencies v1.0.2updated 5y ago

1
a

apitest

Simple and extensible behavioural testing library for REST based services or HTTP handlers that supports mocking external http calls and rendering of sequence diagrams.

apitest.dev

g

ginkgo

BDD Testing Framework for Go.

onsi.github.io

gocheck

More advanced testing framework alternative to gotest.

labix.org

g

gomega

Rspec like matcher/assertion library.

onsi.github.io

Esc

Type to search every entry. ↑↓ to move, Enter to open.