Top 12 Go unit-testing Projects
-
You could use something like the chrome dev tools (https://github.com/chromedp/chromedp) or look into JS runtimes in Go and try to handle the I/O yourself.
-
dockertest
Write better integration tests! Dockertest helps you boot up ephermal docker images for your Go tests with minimal work.
Don't mock. Use https://github.com/ory/dockertest to actually run tests against a dockerized DB.
-
SonarQube
Static code analysis for 29 languages.. Your projects are multi-language. So is SonarQube analysis. Find Bugs, Vulnerabilities, Security Hotspots, and Code Smells so you can release quality code every time. Get started analyzing your projects today for free.
-
keploy
Testing for Developers. Toolkit that creates test-cases and data mocks from API calls, DB queries, etc.
Project mention: Test generating tools - future of test automation? | reddit.com/r/webdev | 2022-12-21I recently discovered Keploy (https://github.com/keploy/keploy) and was really impressed by its promise that it can generate API tests with code coverage by itself just by recording API calls and mocking everything that goes outside of the application - including calls to external API endpoints and the database. It seems like a super useful tool and potentially a game changer, especially now that GPT is starting another wave of automation.
-
service-pattern-go
Simple clean Go REST API architecture with dependency injection and mocking example, following SOLID principles.
Project mention: Question about the service pattern and data racing in Go | reddit.com/r/golang | 2022-05-26Repo for reference: https://github.com/irahardianto/service-pattern-go
-
testza
Full-featured test framework for Go! Assertions, fuzzing, input testing, output capturing, and much more! 🍕
Project mention: Testza: A full-featured go testing framework with developer-friendly output | reddit.com/r/golang | 2022-04-01 -
-
test-at-scale
TAS is an intelligent test execution platform for engineering teams to achieve high development velocity.
Project mention: 2x faster, smarter test execution with Test At Scale written in Go | reddit.com/r/golang | 2022-06-03Check out their Go codebase at https://github.com/lambdatest/test-at-scale
-
InfluxDB
Build time-series-based applications quickly and at scale.. InfluxDB is the Time Series Platform where developers build real-time applications for analytics, IoT and cloud-native services. Easy to start, it is available in the cloud or on-premises.
-
It is not hard to isolate and stub a database the problem is you will not catch a lot of errors, e.g. writing a 40 char string into a VCHAR(10), DateTime conversations, ...
In Ruby on Rails it is quite common to use a real database in the unit tests. Even before containers came out and it is still fast (yes, less than 1 second).
In rails you use the same database instance for all the tests, so you do not have spin up a database instance for every case. Instead you use a database cleaner.
There also exists a JS implementation: https://github.com/khaiql/dbcleaner
-
https://github.com/gkampitakis/go-snaps. Have a look, feedback is always welcome.
-
-
golang-table-tests-with-testify-mock
This repo shows how to test and mock multiple dependencies using table-driven tests with testify-mock in Golang
-
Go unit-testing related posts
Index
What are some of the best open-source unit-testing projects in Go? This list will help you:
Project | Stars | |
---|---|---|
1 | chromedp | 8,594 |
2 | dockertest | 3,195 |
3 | keploy | 1,512 |
4 | service-pattern-go | 685 |
5 | testza | 409 |
6 | got | 261 |
7 | test-at-scale | 205 |
8 | dbcleaner | 148 |
9 | go-snaps | 48 |
10 | mockit | 13 |
11 | golang-table-tests-with-testify-mock | 10 |
12 | go-testpredicate | 5 |