mockery
moq
mockery | moq | |
---|---|---|
20 | 16 | |
6,052 | 1,971 | |
1.9% | - | |
8.1 | 5.2 | |
10 days ago | about 2 months ago | |
Go | Go | |
BSD 3-clause "New" or "Revised" License | MIT License |
Stars - the number of stars that a project has on GitHub. Growth - month over month growth in stars.
Activity is a relative number indicating how actively a project is being developed. Recent commits have higher weight than older ones.
For example, an activity of 9.0 indicates that a project is amongst the top 10% of the most actively developed projects that we are tracking.
mockery
-
I Write Tests in Go
I'm far too lazy to write mocks by hand in go. You can generate a mock for a given interface with mockery https://github.com/vektra/mockery
-
go-ecommerce-microservices: A practical e-commerce microservices, built with cqrs, event sourcing, vertical slice architecture, event-driven architecture.
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
- Direction of mockery: absorb different styles of mocks into this project · vektra mockery · Discussion #671
-
Go: Write Mock Test cases using Mockery and
Read mockery documentation: https://vektra.github.io/mockery/
-
Mocking unexported interfaces?
https://github.com/vektra/mockery is the better mocking framework in my biased opinion. The Google maintainers for gomock seem to have neglected the project.
-
I want to contribute to open source but don't know where to start
There are some one liner changes you can implement in https://github.com/vektra/mockery
-
Is gomock still maintained and recommended?
When there's just one heavyweight dependency you're interacting with, perhaps a one-off stub/fake is simpler, but I would posit that auto-generated mocks via things like mockery + go:generate leave less test code to maintain vs. perhaps many stubs across the project.
-
vektra/mockery: v2.21.0 includes "packages" config section, allowing 5x faster mock generation and more fine-grained control over mocks
Please take a look at the documentation linked here, and the related discussion topic that spawned this.
-
Issue implementing interface method that returns another interface
As you can see, the package has a chained method Logical().Write() . Since I want to create tests for PublicFunctionIWantToTest, I want to pass down all the functionality as interface so that I can use https://vektra.github.io/mockery/ to create mocks for it.
- FEEDBACK REQUESTED: Deprecation of automatic interface discovery · Discussion #549 · vektra/mockery
moq
- vektra/mockery has fully released the "packages" feature! This blog explains what it is and how it works.
- Why elixir over Golang
-
Is gomock still maintained and recommended?
``` https://github.com/matryer/moq
-
How do you write/generate mocks for testing?
Currently trying out https://github.com/matryer/moq for the first time, and quite positive so far. Haven't pushed it enough yet to give a real opinion.
-
gomock giving me a hard time
I like moq much better than gomock. Much simpler and easier to work with.
-
how to mock DBs
Just replaced mockery generated mocks with https://github.com/matryer/moq Alot cleaner imo at least for me
- Testify Mocking conundrums
-
Can someone please comment on this mock example from Jon Calhoun's post on DDD?
btw, you can avoid making such mocks manually by using https://github.com/matryer/moq, which will generate such mocking code for you
-
How do you control behaviour in mocked interface ?
I like the way of matryer/moq a lot. Basically, it generates a func for each of the methods of an interface, therefore the behaviour is clear to everyone without too much abstraction.
-
What mocking framework do you prefer?
This one is easy to use, simple, powerful and idiomatic https://github.com/matryer/moq
What are some alternatives?
gomock - GoMock is a mocking framework for the Go programming language.
counterfeiter - A tool for generating self-contained, type-safe test doubles in go
Testify - A toolkit with common assertions and mocks that plays nicely with the standard library
go-sqlmock - Sql mock driver for golang to test database interactions
go-concurrency-exercises - Hands on exercises with real-life examples to study and practice Go concurrency patterns. Test-cases are provided to verify your answers.
minimock - Powerful mock generation tool for Go programming language
NSubstitute - A friendly substitute for .NET mocking libraries.
hoverfly - Lightweight service virtualization/ API simulation / API mocking tool for developers and testers
redismock - Redis client Mock
webmock - Webmock for Golang, to stub requests.