Go Testing

Open-source Go projects categorized as Testing

Top 23 Go Testing Projects

  • Testify

    A toolkit with common assertions and mocks that plays nicely with the standard library

    Project mention: What 3rd-party libraries do you use often/all the time? | /r/golang | 2023-12-01

    github.com/stretchr/testify

  • learn-go-with-tests

    Learn Go with test-driven development

    Project mention: quii/learn-go-with-tests: Learn Go with test-driven development | /r/devopsish | 2023-08-20
  • WorkOS

    The modern identity platform for B2B SaaS. The APIs are flexible and easy-to-use, supporting authentication, user identity, and complex enterprise features like SSO and SCIM provisioning.

  • Gor

    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.

  • chromedp

    A faster, simpler way to drive browsers supporting the Chrome DevTools Protocol.

    Project mention: Web scraping with Go | /r/golang | 2023-04-02
  • toxiproxy

    :alarm_clock: :fire: A TCP proxy to simulate network and system conditions for chaos and resiliency testing

    Project mention: Speedbump – a TCP proxy to simulate variable network latency | news.ycombinator.com | 2024-01-16

    Checkout also shopify's awesome tool called toxiproxy: https://github.com/Shopify/toxiproxy

    It turns out to be also a very good way to test a networking library by implementing it. Since your stack needs to be able to basically handle most adverse events properly.

    The idea behind 'chaos engineering' is cool.

  • GoConvey

    Go testing in the browser. Integrates with `go test`. Write behavioral tests in Go.

    Project mention: Gokiburi: Automatic Test Runs for Go Projects | /r/golang | 2023-05-07

    I have always liked to use the similar GoConvey tool for automatic test runs during development, but it has definitely started to “show its age” and since Go 1.20 it hasn’t been able to parse code coverage correctly. So, I decided to dive into making my own tool to replace it for me.

  • ginkgo

    A Modern Testing Framework for Go

    Project mention: Writing tests for a Kubernetes Operator | dev.to | 2023-10-07

    Ginkgo: a testing framework based on the concept of ‌"Behavior Driven Development" (BDD)

  • InfluxDB

    Power Real-Time Data Analytics at Scale. Get real-time insights from all types of time series data with InfluxDB. Ingest, query, and analyze billions of data points in real-time with unbounded cardinality.

  • terratest

    Terratest is a Go library that makes it easier to write automated tests for your infrastructure code.

    Project mention: Saw a not-so-good thing in my pipeline. How do we fix it? | /r/Terraform | 2023-06-02

    I think I found it. This is the one right? https://github.com/gruntwork-io/terratest/

  • go-grpc-middleware

    Golang gRPC Middlewares: interceptor chaining, auth, logging, retries and more.

    Project mention: Seeking advice on implementing a tinyurl-like service using Go and gRPC. | /r/golang | 2023-05-24

    Hello, Those interviews are even crazy for internship. Anyway 1. Try to find a simple CRUD example online. You can check [this](https://tutorialedge.net/golang/go-grpc-beginners-tutorial/) 2. For logging you can check [go-grpc-middleware](https://github.com/grpc-ecosystem/go-grpc-middleware) 3. You can grpc-gateway in case they want some REST endpoints too 4. Use base62 to encode your url. So at least 2 columns in your table **shortenedUrl** and **url** 5. For such a project no need to use an ORM ( it's not advised anyway ). Implement 2 functions, one to insert into the db and the other one to read from the db. Remember to use transaction though 5. For unit tests go with the standard library and mock the 2 functions ( erroneous and valid cases )

  • go-sqlmock

    Sql mock driver for golang to test database interactions

    Project mention: How do you unit-test code that reaches out to the db, without introducing interfaces everywhere? | /r/golang | 2023-08-16
  • mockery

    A mock code autogenerator for Go (by vektra)

    Project mention: go-ecommerce-microservices: A practical e-commerce microservices, built with cqrs, event sourcing, vertical slice architecture, event-driven architecture. | /r/golang | 2023-08-26

    Some of the features: - ✅ Using Vertical Slice Architecture as a high level architecture - ✅ Using Event Driven Architecture on top of RabbitMQ Message Broker with a custom [Event Bus](pkg/messaging/bus/) - ✅ Using Event Sourcing in Audit Based services like [Orders Service](services/orders/) - ✅ Using CQRS Pattern and Mediator Patternon top of Go-MediatR library - ✅ Using Dependency Injection and Inversion of Controlon top of uber-go/fx library - ✅ Using RESTFul api with Echo framework and using swagger with swaggo/swag library - ✅ Using Postgres and EventStoreDB to write databases with fully supports transactions(ACID) - ✅ Using MongoDB and Elastic Search for read databases (NOSQL) - ✅ Using OpenTelemetry for collection Distributed Tracing with using Jaeger and Zipkin - ✅ Using OpenTelemetry for collection Metrics with using Prometheus and Grafana - ✅ Using Unit Test for testing small units with mocking dependent classes and using Mockery for mocking dependencies - ✅ Using End2End Test and Integration Test for testing features with all of their real dependeinces using docker containers (cleanup tests) and testcontainers-go library

  • goss

    Quick and Easy server testing/validation

    Project mention: Tools for validating K8s features | /r/kubernetes | 2023-06-08

    Certain checks may be possible with goss and the kgoss wrapper: https://github.com/goss-org/goss/tree/master/extras/kgoss

  • syzkaller

    syzkaller is an unsupervised coverage-guided kernel fuzzer

    Project mention: Automated Unit Test Improvement Using Large Language Models at Meta | news.ycombinator.com | 2024-02-17

    https://arxiv.org/abs/2402.09171 :

    > This paper describes Meta's TestGen-LLM tool, which uses LLMs to automatically improve existing human-written tests. TestGen-LLM verifies that its generated test classes successfully clear a set of filters that assure measurable improvement over the original test suite, thereby eliminating problems due to LLM hallucination. [...] We believe this is the first report on industrial scale deployment of LLM-generated code backed by such assurances of code improvement.

    Coverage-guided unit test improvement might [with LLMs] be efficient too.

    https://github.com/topics/coverage-guided-fuzzing :

    - e.g. Google/syzkaller is a coverage-guided syscall fuzzer: https://github.com/google/syzkaller

    - Gitlab CI supports coverage-guided fuzzing: https://docs.gitlab.com/ee/user/application_security/coverag...

    - oss-fuzz, osv

    Additional ways to improve tests:

    Hypothesis and pynguin generate tests from type annotations.

    There are various tools to generate type annotations for Python code;

    > pytype (Google) [1], PyAnnotate (Dropbox) [2], and MonkeyType (Instagram) [3] all do dynamic / runtime PEP-484 type annotation type inference [4] to generate type annotations. https://news.ycombinator.com/item?id=39139198

    icontract-hypothesis generates tests from icontract DbC Design by Contract type, value, and invariance constraints specified as precondition and postcondition @decorators:

  • gotests

    Automatically generate Go test boilerplate from your source code.

    Project mention: Russ Cox: Go Testing by Example | news.ycombinator.com | 2023-12-05

    A huge time-saver for me when generating table-driven test boilerplate in Go has been using gotests[0] to generate the template.

    If you use VSCode with the Go extension it's already available there as a command "Go: Generate Unit Tests for Function/Package".

    [0] https://github.com/cweill/gotests

  • go-fuzz

    Randomized testing for Go

    Project mention: Fuzzing in Go | /r/golang | 2023-06-10

    I used this method successfully for my qjson package . It accepts as input a human readable json. It detected a condition I forgot to check in a few minutes. I used the go fuzzer go-fuzz from Dmitry Vyukov. Check the impressive list of trophies at the end of the README. These are bugs found by the fuzzer.

  • rod

    A Devtools driver for web automation and scraping

    Project mention: Need help authenticating to Okta programatically. | /r/okta | 2023-07-03

    I have tried the following. 1. Login to Okta via browser programatically using go-rod. Which I managed to do so successfully, but I'm failing to load up Slack as it's stuck in the browser loader screen for Slack. 2. I tried to authenticate via Okta RESTful API. So far, I have managed to authenticate using {{domain}}/api/v1/authn, and then subsequently using MFA via the verify endpoint {{domain}}/api/v1/authn/factors/{{factorID}}/verify which returns me a sessionToken. From here, I can successfully create a sessionCookie which have proven quite useless to me. Perhaps I am doing it wrongly.

  • 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.

  • HTTPLab

    The interactive web server

  • go-cmp

    Package for comparing Go values in tests

  • dockertest

    Write better integration tests! Dockertest helps you boot up ephermal docker images for your Go tests with minimal work.

    Project mention: Testcontainers | news.ycombinator.com | 2024-02-27

    I am using https://github.com/ory/dockertest for tests, specifically for databases. Is there any advantage to use Testcontainers?

  • keploy

    Test generation for Developers. Generate tests and stubs for your application that actually work!

    Project mention: Getting Started with Keploy | dev.to | 2024-02-12

    October is the month of Open Source and Keploy is taking part in this celebration. You can contribute to several Keploy projects by participating in this year’s Hacktoberfest. You can both contribute to the code part and the no-code part as well. Here are some contributions that you can make!

  • testcontainers-go

    Testcontainers for Go is 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.

    Project mention: Using test helpers in Go | dev.to | 2024-02-16

    Let's first look at the original version of the test, in this case, an end-to-end, using testcontainers.

  • Gauge

    Light weight cross-platform test automation

    Project mention: Python-Selenium-Action: Run Selenium with Python via Github Actions using Headless or Non-Headless browsers! | /r/Python | 2023-05-03

    Selenium is cool but https://gauge.org/ really cuts down on the boilerplate and is a lot more lightweight, may want to give it a look too

  • SaaSHub

    SaaSHub - Software Alternatives and Reviews. SaaSHub helps you find the best software and product alternatives

NOTE: The open source projects on this list are ordered by number of github stars. The number of mentions indicates repo mentiontions in the last 12 Months or since we started tracking (Dec 2020). The latest post mention was on 2024-02-27.

Go Testing related posts

Index

What are some of the best open-source Testing projects in Go? This list will help you:

Project Stars
1 Testify 21,731
2 learn-go-with-tests 21,039
3 Gor 18,201
4 chromedp 10,207
5 toxiproxy 10,186
6 GoConvey 8,061
7 ginkgo 7,832
8 terratest 7,292
9 go-grpc-middleware 5,985
10 go-sqlmock 5,759
11 mockery 5,506
12 goss 5,416
13 syzkaller 5,057
14 gotests 4,817
15 go-fuzz 4,698
16 rod 4,627
17 realize 4,436
18 HTTPLab 3,975
19 go-cmp 3,923
20 dockertest 3,908
21 keploy 3,205
22 testcontainers-go 2,931
23 Gauge 2,931
SaaSHub - Software Alternatives and Reviews
SaaSHub helps you find the best software and product alternatives
www.saashub.com