Testify
A toolkit with common assertions and mocks that plays nicely with the standard library (by stretchr)
ginkgo
A Modern Testing Framework for Go (by onsi)
Our great sponsors
Testify | ginkgo | |
---|---|---|
56 | 10 | |
19,223 | 7,020 | |
2.7% | - | |
6.5 | 5.9 | |
12 days ago | 4 days ago | |
Go | Go | |
MIT License | MIT License |
The number of mentions indicates the total number of mentions that we've tracked plus the number of user suggested alternatives.
Stars - the number of stars that a project has on GitHub. Growth - month over month growth in stars.
Activity is a relative number indicating how actively a project is being developed. Recent commits have higher weight than older ones.
For example, an activity of 9.0 indicates that a project is amongst the top 10% of the most actively developed projects that we are tracking.
Stars - the number of stars that a project has on GitHub. Growth - month over month growth in stars.
Activity is a relative number indicating how actively a project is being developed. Recent commits have higher weight than older ones.
For example, an activity of 9.0 indicates that a project is amongst the top 10% of the most actively developed projects that we are tracking.
Testify
Posts with mentions or reviews of Testify.
We have used some of these posts to build our list of alternatives
and similar projects. The last one was on 2023-03-06.
-
Is gomock still maintained and recommended?
FWIW, I've been using testify and mockery for years.
To answer OP directly, I am largely quite happy with mockery (and testify) to write expressive tests.
-
Golang, GraphQL y Postgress
Como herramientas te recomiendo: FastJson https://github.com/valyala/fastjson : Si necesitas leer jsons Testify https://github.com/stretchr/testify : Para mockear y testear
-
How to develop a Web app in go
Indispensable for testing your code: https://github.com/stretchr/testify
-
What's your favourite part of unit testing?
Best tool in the ecosystem testify. Learn about Table driven test, suite - saves your time so much with setup & teardown. Absolutely one thing you need to follow, if you see anything breaking (or bugs) add tests for that, could be unit tests or integration tests, this's of huge value and reduces manual testsing.
-
TIL: panic(spew.Sdump(myVar))
I use https://github.com/stretchr/testify in tests, it prints structs and diffs very well
- Learning Go and I don't like some features, maybe it's me?
- Criando uma API Rest com Fiber - Uma história pessoal de aprendizado
-
How do you do DB preparation in e2e tests?
Assertion libraries that people seem to love: - testify (my favorite) - go-cmp is a more barebones library - gotest.tools -- I have never used this but some swear by it
-
goyek v2 RC - feedback needed
It can be easily used with https://pkg.go.dev/flag or https://github.com/spf13/viper (for configuration) and even https://github.com/stretchr/testify (for asserting)
ginkgo
Posts with mentions or reviews of ginkgo.
We have used some of these posts to build our list of alternatives
and similar projects. The last one was on 2023-01-17.
-
ginkgo integration with jira/elasticsearch/webex/slack
If you are using Ginkgo for your e2e, this library might of help.
-
Testing frameworks, which to use?
https://onsi.github.io/ginkgo/ offers a simple way to create tables with different scenarios useful to generate different test cases based on a file like a yml without to need to develop useless code. Maybe at start seems to be a little verbose but depends how you design the test case.
If you like BDD and more expressive tests, go get ginkgo. It is a pain in the back get the hang of its R-spec like syntax, but if you're good at it and you like it, it is very expressive and readable. It has its own matcher (assertions library), gomega, but if you don't like it, you can still use testify instead.
-
Testza - A modern test framework with pretty output
What are people’s thoughts on testing frameworks? I’ve heard that most devs only use the testing package in the standard library and the testify package for assertions— I assume this is because Go is meant to be lightweight and scalable, and adding external dependencies basically goes against that. But I’ve also seen devs use packages like ginkgo to make tests more structured and readable. What do you guys think?
-
What are your favorite packages to use?
Ginkgo Behavioural test framework
-
Air – Live reload when developing with Go
If you write your tests with Ginkgo [0] its CLI can do this for you. It also has nice facilities to quickly disable a test or portion of a test by pretending an X to the test function name, or to focus a test (only run that test) by prepending an F. It’s pretty nice.
-
Half a million lines of Go at The Khan Academy
The BDD testing framework Ginko [1] has some "weird" / unidiomatic patterns, yet it is very popular
-
Ginkgo for unit testing?
To settle an argument amongst my coworkers, I started a Twitter poll on using Gingko for golang unit testing. Some like the framework because it makes tests clean. Others hate it with a firey passion.
-
Autobucket Operator
As a big fan of automated testing, it’s comforting to learn that we can easily write tests for our controllers using envtest (which runs a local k8s control plane so we can run our tests against it), the Gingko testing framework and the Gomega matching/assertion library:
What are some alternatives?
When comparing Testify and ginkgo you can also consider the following projects:
GoConvey - Go testing in the browser. Integrates with `go test`. Write behavioral tests in Go.
godog - Cucumber for golang
gomega - Ginkgo's Preferred Matcher Library
gomock - GoMock is a mocking framework for the Go programming language.
gotest.tools - A collection of packages to augment the go testing package and support common patterns.
go-cmp - Package for comparing Go values in tests
gocheck - Rich testing for the Go language
goblin - Minimal and Beautiful Go testing framework
assert - :exclamation:Basic Assertion Library used along side native go testing, with building blocks for custom assertions
httpexpect - End-to-end HTTP and REST API testing for Go.