ginkgo
Testify
ginkgo | Testify | |
---|---|---|
20 | 71 | |
8,512 | 23,938 | |
0.8% | 0.9% | |
8.6 | 8.2 | |
6 days ago | about 2 months ago | |
Go | Go | |
MIT License | MIT License |
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.
ginkgo
-
Mastering Golang Debugging in Emacs
Debug both standard applications and Ginkgo tests (this is what I'm using at the moment 🤷)
-
Go-DOM - 1st major milestone
Let's explore a simple test, as it looks now in the code base (the code uses Ginkgo and Gomega, a somewhat overlooked combination IMHO)
-
Functional Programming in Go
Take a look at the Ginkgo testing framework to see the horrors of shoe horning FP into Go
https://onsi.github.io/ginkgo/#writing-specs
-
Show HN: Gomponents, HTML components in pure Go
It's the same with the Ginkgo testing library: "After the package books_test declaration we import the ginkgo and gomega packages into the test's top-level namespace by performing a . dot-import. Since Ginkgo and Gomega are DSLs this makes the tests more natural to read."
https://onsi.github.io/ginkgo/
-
Leverage Your Test Suite With testcontainers-go & docker-compose
The ginkgo testing framework helps us in building the test suite. It's entirely written in Go. Furthermore, it provides a CLI utility to set up and run the tests. Since we will use it later, let's download it from here. You can download it in two ways:
-
Writing tests for a Kubernetes Operator
Ginkgo: a testing framework based on the concept of ‌"Behavior Driven Development" (BDD)
-
We moved our Cloud operations to a Kubernetes Operator
We were also able to leverage Ginkgo's parallel testing runtime to run our integration tests on multiple concurrent processes. This provided multiple benefits: we could run our entire integration test suite in under 10 minutes and also reuse the same suite to load test the operator in a production-like environment. Using these tests, we were able to identify hot spots in the code that needed further optimization and experimented with ways to save API calls to ease the load on our own Kubernetes API server while also staying under various AWS rate limits. It was only after running these tests over and over again that I felt confident enough to deploy the operator to our dev and prod clusters.
-
Recommendations for Learning Test-Driven Development (TDD) in Go?
A bit off-topic, but i really like the ginkgo BDD framework
-
Start test names with “should” (2020)
You obviously are not familiar with the third circle of golang continuous integration hell that is ginkgo+gomega:
https://onsi.github.io/ginkgo/#adding-specs-to-a-suite
It’s actually worse than that example suggests. Stuff like Expect(“type safety”).ShouldBe(GreaterThan(13)) throws runtime errors.
The semantics of parallel test runs weren’t defined anywhere the last time I checked.
Anyway, you’ll be thinking back fondly to the days of TestShouldReplaceChildrenWhenUpdatingInstance because now you need to write nested function calls like:
Context(“instances”, func …)
Describe(“that are being updated”, …)
Expect(“should replace children”, …)
And to invoke that from the command line, you need to write a regex against whatever undocumented and unprinted string it internally concatenates together to uniquely describe the test.
Also, they dump color codes to stdout without checking that they are writing to a terminal, so there will be line noise all over whatever automated test logs you produce, or if you pipe stdout to a file.
-
ginkgo integration with jira/elasticsearch/webex/slack
If you are using Ginkgo for your e2e, this library might of help.
Testify
-
Building and Deploying a New API (Part 1)
nil is returned initially, as we're creating user_test.go and using Testify to create tests as we shape the behavior of PostUser. We don't have a DB wired up yet, so the responses will simply be hard-coded structs of what we expect the API to respond with for now to pass the tests.
-
Top 5 Go Libraries Every Backend Developer Should Know
Bonus: Testify
-
TypeScript vs Go: Choosing Your Backend Language
Testify: Popular framework with assertion functions and mock objects.
-
Building a RESTful API with Go Fiber: An Express-Inspired Boilerplate
Testing: unit and integration tests using Testify and formatted test output using gotestsum
-
Technical Deep Dive: How We Built the Pizza CLI Using Go and Cobra
We’ve integrated the excellent testify library with its “assert” functionality to allow for smoother test implementation:
-
Full Introduction to Golang with Test-Driven Development
This article is too basic and does not introduce anything you'd encounter in a typical Go project. If you want introduction to Go testing I recommend just reading the official docs https://pkg.go.dev/testing and understanding how to write table driven tests - https://go.dev/wiki/TableDrivenTests.
Going beyond what's built in, get familiar with https://github.com/stretchr/testify as that's used a lot.
-
Why I don't use a third-party assertion library in Go unit tests
Of course, as soon as people saw this, the third-party assertion helper libraries started appearing. The most popular one seems to be testify (although I've never used it). Personally, I thought that the explicit check would be good enough for me, but it's true that after writing a bunch of tests, the boilerplate does seem unnecessarily verbose.
-
What 3rd-party libraries do you use often/all the time?
github.com/stretchr/testify
-
Testing calls to Daily's REST API in Go
I then verify that there are no issues with writing the body with require.NoError() from the testify toolkit. This will ensure the test fails if something happens to go wrong at this point.
-
Gopher Pythonista #1: Moving From Python To Go
For testing purposes, Go provides a go test command that automatically discovers tests within your application and supports features such as caching and code coverage. However, if you require more advanced testing capabilities such as suites or mocking, you will need to install a toolkit like testify. Overall, while Go provides a highly effective testing experience, it's worth noting that writing tests in Python using pytest is arguably one of the most enjoyable testing experiences I have encountered across all programming languages.
What are some alternatives?
godog - Cucumber for golang
gomega - Ginkgo's Preferred Matcher Library
GoConvey - Go testing in the browser. Integrates with `go test`. Write behavioral tests in Go.
httpexpect - End-to-end HTTP and REST API testing for Go.
gotest.tools - A collection of packages to augment the go testing package and support common patterns.
goblin - Minimal and Beautiful Go testing framework
go-cmp - Package for comparing Go values in tests
Gauge - Light weight cross-platform test automation
gocheck - Rich testing for the Go language