gotests makes writing Go tests easy. It's a Golang commandline tool that generates table driven tests based on its target source files' function and method signatures. Any new dependencies in the test files are automatically imported.
Minimum Go version: Go 1.6
go get to install and update:
$ go get -u github.com/cweill/gotests/...
From the commandline,
gotests can generate Go tests for specific source files or an entire directory. By default, it prints its output to
$ gotests [options] PATH ...
-all generate tests for all functions and methods -excl regexp. generate tests for functions and methods that don't match. Takes precedence over -only, -exported, and -all -exported generate tests for exported functions and methods. Takes precedence over -only and -all -i print test inputs in error messages -only regexp. generate tests for functions and methods that match only. Takes precedence over -all -nosubtests disable subtest generation when >= Go 1.7 -w write output to (test) files instead of stdout -template_dir Path to a directory containing custom test code templates -template_params_file read external parameters to template by json with file -template_params read external parameters to template by json with stdin
Contributing guidelines are in CONTRIBUTING.md.
gotests is released under the Apache 2.0 License.