Top 23 Go Testing Projects
-
goreplay
GoReplay is an open-source tool for capturing and replaying live HTTP traffic into a test environment in order to continuously test your system with real data. It can be used to increase confidence in code deployments, configuration changes and infrastructure changes.
Not OP, but that is the idea. I use this tool for it, as it is dead-simple to get running and fairly configurable: https://github.com/buger/goreplay
-
learn-go-with-tests
Learn Go with test-driven development
Learn Go with Tests should be higher on the list. I'd do this after finishing A Tour of Go.
-
testify
A toolkit with common assertions and mocks that plays nicely with the standard library
Code for another gRPC methods and some tests you can find in th repository. For testing and mocking i can recomend testify and gomock.
-
goconvey
Go testing in the browser. Integrates with `go test`. Write behavioral tests in Go.
-
chromedp
A faster, simpler way to drive browsers supporting the Chrome DevTools Protocol.
The built in Go HTTP package is more than capable at sending off the HTTP requests you need. I have some articles on my blog that teach you how to use the chrome dev tools to spot requests to mimic. If the site you're automating has TLS fingerprinting you may want to take a look at uTLS to mimic the fingerprint of popular modern browsers. If the request route is proving to be too much work you can use chromedp which allows you to control Chrome. Hope this helps
-
mock
GoMock is a mocking framework for the Go programming language.
Ref. golang/mock
-
toxiproxy
:alarm_clock: :fire: A TCP proxy to simulate network and system conditions for chaos and resiliency testing
-
terratest
Terratest is a Go library that makes it easier to write automated tests for your infrastructure code.
Latest mention: Testing in Infrastructure as Code and why Terraform may not be the best option | dev.to | 2021-01-06You can’t use Terratest assertions with LocalStack and there is an open pull request https://github.com/gruntwork-io/terratest/pull/495 solving this issue. Of course, you could write your own assertions and we will do it later in a different language, so let’s skip this now and move on.
-
ginkgo
BDD Testing Framework for Go
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:
-
goss
Quick and Easy server testing/validation
The repository is private but there is a CI/CD no-downtime deployment process. So fancy! I use goss to test the built image along with the docker/build-push-action. The end of my ci.yml GitHub Action workflow looks like this:
-
realize
Realize is the #1 Golang Task Runner which enhance your workflow by automating the most common tasks and using the best performing Golang live reloading.
-
go-fuzz
Randomized testing for Go
-
go-grpc-middleware
Golang gRPC Middlewares: interceptor chaining, auth, logging, retries and more.
And initialize our gRPC service, here i used gRPC Middleware repository for unary interceptors:
-
go-sqlmock
Sql mock driver for golang to test database interactions
-
gotests
Automatically generate Go test boilerplate from your source code.
You can save yourself a minute and generate the test case boilerplate for your with https://github.com/cweill/gotests :)
-
gauge
Light weight cross-platform test automation
-
go-cmp
Package for comparing Go values in tests
-
selenoid
Selenium Hub successor running browsers within containers. Scalable, immutable, self hosted Selenium-Grid on any platform with single binary.
-
hoverfly
Lightweight service virtualization/API simulation tool for developers and testers
-
httpexpect
End-to-end HTTP and REST API testing for Go.
Latest mention: Hacktoberfest: 69 Beginner-Friendly Projects You Can Contribute To | dev.to | 2020-09-29https://github.com/gavv/httpexpect End-to-end HTTP and REST API testing for Go.
-
conftest
Write tests against structured configuration data using the Open Policy Agent Rego query language
Latest mention: Mental models for understanding Kubernetes Pod Security Policy PSP | reddit.com/r/kubernetes | 2021-01-16Can Gatekeeper and Conftest single-source the same set of rules? I'm looking at https://github.com/open-policy-agent/conftest/issues/54#issuecomment-528988831 and not seeing how.
-
selenium
Selenium/Webdriver client for Go
-
rod
A Devtools driver for web automation and scraping
Index
What are some of the best open-source Testing projects in Go? This list will help you:
Project | Stars | |
---|---|---|
1 | goreplay | 13,780 |
2 | learn-go-with-tests | 12,669 |
3 | testify | 12,323 |
4 | goconvey | 6,130 |
5 | chromedp | 5,791 |
6 | mock | 5,085 |
7 | toxiproxy | 5,071 |
8 | terratest | 4,653 |
9 | ginkgo | 4,463 |
10 | goss | 4,231 |
11 | realize | 3,896 |
12 | go-fuzz | 3,785 |
13 | go-grpc-middleware | 3,281 |
14 | go-sqlmock | 3,100 |
15 | gotests | 2,994 |
16 | gauge | 2,407 |
17 | go-cmp | 2,108 |
18 | selenoid | 1,790 |
19 | hoverfly | 1,687 |
20 | httpexpect | 1,583 |
21 | conftest | 1,551 |
22 | selenium | 1,302 |
23 | rod | 1,296 |