SaaSHub helps you find the best software and product alternatives Learn more →
Top 8 Go Tdd Projects
-
-
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.
-
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.
-
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
-
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.
-
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
-
-
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
Go Tdd related posts
- Offline Resources for Learning Go
- Why unit test flask app?
- Is docker the right tool for my use case? (testing an installscript)
- Portable security testing tooling (not chef inspec)
- Please share programming/CS books and articles that use Go as examples(but not strictly about Go)
- Using SQLC in project how do I mock database Calls with it for unit testing?
- Learn Go with Tests: Scaling acceptance tests (with a light intro to gRPC)
-
A note from our sponsor - #<SponsorshipServiceOld:0x00007f160cc05ea8>
www.saashub.com | 1 Apr 2023
Index
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 |