A mock code autogenerator for Go
mockery provides the ability to easily generate mocks for Golang interfaces using the stretchr/testify/mock package. It removes the boilerplate coding required to use mocks.
Documentation is found at out GitHub Pages site.
taskfile.dev is used for build tasks. Initialize all go build tools:
go mod download -x
You can run any of the steps listed in Taskfile.yml
:
$ task test
task: [test] go test -v -coverprofile=coverage.txt ./...
v1 is the original version of the software, and is no longer supported.
mockery
is currently in v2, which originally included cosmetic and configuration improvements over v1, but also implements a number of quality-of-life additions.
v3 will include a ground-up overhaul of the entire codebase and will completely change how mockery works internally and externally. The highlights of the project are:
mockery
currently iterates over every file in a project and calls package.Load
on each one, which is time-consuming. Moving towards a model where the entire package is loaded at once will dramatically reduce runtime, and will simplify logic. Additionally, supporting only a single mode of operation (package mode) will greatly increase the intuitiveness of the software.v3
will be entirely driven by configuration, meaning: