Open scr-oath opened 5 years ago
I agree, would be lovely to have it right in testify
But, until that's a reality, you could always try https://github.com/vektra/mockery. I've used it with success so far
Maybe just a link to that from testify mock package godoc would do the trick?
-SCR
Sent from my iPhone
On Feb 15, 2019, at 9:40 PM, Nathaniel Morihara notifications@github.com wrote:
I agree, would be lovely to have it right in testify
but, until that's a reality, you could always try https://github.com/vektra/mockery. I've used it with success so far
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/stretchr/testify/issues/728#issuecomment-464295272, or mute the thread https://github.com/notifications/unsubscribe-auth/An-w7d5ytP48VK_xU7em34lpJNKccaBbks5vN5nhgaJpZM4a-WQD .
Unfortunately vektra/mockery does not seem to be maintained. I agree it would be somewhat better if this package provided a solution OOTB.
I am forced to remove vektra/mockery
in most places as it seems to be causing quite a bit of issues (OOMs in containers etc) and requires to vendor dependencies to mock 3rd-party packages. Luckily in my case it's fairly easy to hand-mock things.
Would love to have an out of the box solution for it that also works with modules.
I've built a tool for generating code and added support for generating testify mocks:
https://github.com/sagikazarmark/mga#testify-mock-generator
It works well with modules as well.
I'm working on better documentation for the project, but the tool already works and generates mocks in a real life project.
https://github.com/matryer/moq generates a mock from an interface which, though nice, isn't as rich a mocking language as testify (ability to just say how many times, or return what as part of test).
It would be great if testify could provide a means of generating, for instance, from:
this: