Go Tdd

Open-source Go projects categorized as Tdd

Top 8 Go Tdd Projects

  • learn-go-with-tests

    Learn Go with test-driven development

    Project mention: Offline Resources for Learning Go | reddit.com/r/golang | 2023-03-02
  • go-sqlmock

    Sql mock driver for golang to test database interactions

    Project mention: Creating an API using Go and sqlc | dev.to | 2022-10-24

    For that, I used the lib go-sqlmock. So, for example, the following snippet is part of the person/service_test.go file:

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

  • goss

    Quick and Easy server testing/validation

    Project mention: Is docker the right tool for my use case? (testing an installscript) | reddit.com/r/docker | 2023-01-22

    Docker would work. I suggest also integrating infrastructure tests to validate your install script behaved as expected. For example, you could use goss.

  • go-txdb

    Immutable transaction isolated sql driver for golang

    Project mention: Integration Tests with Postgres | reddit.com/r/golang | 2023-03-29

    3 years ago I created a internal library where I worked to setup the testing with the db's. One param was the schema directory and the other one was the path of the data insertion file. It worked really well but was a little slow. It was a little bit weird to configure the container to run the tests. As I would have to give access to go container that ran the unit tests access to docker. But back then I was running boot2docker and made things very cumbersome. I think with a local docker things would be way simpler. I ended up using and normal DB from the CI/CD and https://github.com/DATA-DOG/go-txdb If I had to do it again I might do an hybrid in-between the two solutions

  • pgxmock

    pgx mock driver for golang to test database interactions

    Project mention: Using SQLC in project how do I mock database Calls with it for unit testing? | reddit.com/r/golang | 2022-10-22

    It's not the right call IMO to skip mocking the database connection to achieve 100% test coverage. How your app will behave in failure scenarios that are impossible to imitate during integration tests is part of the software contract. If your choice is to panic, or return an error, document that by testing that behavior. If another dev, or future you inadvertently breaks the contract, the test suite will fail. That's what you want. For unit tests against your database you should be using either go-sqlmock if testing against database/sql or pgxmock if testing against pgx. That being said, the points raised elsewhere in this thread regarding unit tests potentially hiding edge cases in terms of how an actual database will interact with your application that are not reflective of your understanding when writing mocks are 100% valid. You should do both. Unit test your app and write integration tests as well. On my team, we run integration tests using docker-compose.

  • testcase

    testcase is an opinionated testing framework to support test driven design.

    Project mention: testing utility for time manipulation and pretty printing | reddit.com/r/golang | 2022-08-12

    One of them focuses on time manipulation for testing purposes: - Freeze time to a specific point. - Travel back to a specific time, but allow time to continue moving forward. - Scale time by a given scaling factor will cause the time to move at an accelerated pace. - No dependencies other than the stdlib - Nested calls to timecop.Travel is supported - Works with any regular Go projects

  • gomatch

    Library created for testing JSON against patterns.

  • InfluxDB

    Access the most powerful time series database as a service. Ingest, store, & analyze all types of time series data in a fully-managed, purpose-built database. Keep data forever with low-cost storage and superior data compression.

  • 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

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 2023-03-29.

Go Tdd related posts


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

Project Stars
1 learn-go-with-tests 19,417
2 go-sqlmock 5,123
3 goss 5,118
4 go-txdb 522
5 pgxmock 136
6 testcase 106
7 gomatch 44
8 golang-table-tests-with-testify-mock 10
SaaSHub - Software Alternatives and Reviews
SaaSHub helps you find the best software and product alternatives