gounit alternatives and similar packages
Based on the "Go Generate Tools" category.
Alternatively, view gounit alternatives based on common mentions on social networks and blogs.
Do you think we are missing an alternative of gounit or a related project?
GoUnit is a commandline tool that generates tests stubs based on source function or method signature.
There are plugins for
go get -u github.com/hexdigest/gounit/cmd/gounit
Usage of GoUnit
This will generate test stubs for all functions and methods in file.go
$ gounit gen -i file.go
gounit help for more options
Custom test templates
If you're not satisfied with the code produced by the default GoUnit test template you can always write your own! You can use minimock template as an example. Here is how to add and switch to the custom template:
$ curl https://raw.githubusercontent.com/hexdigest/gounit/master/templates/minimock > minimock $ gounit template add minimock $ gounit template list gounit templates installed * default minimock $ gounit template use minimock
Minimock template produces test stubs that are aware of the mocks generated by the minimock mock generator. By using both of these tools you can automate the process of writing tests and focus on your test cases rather than routine operations.
Integration with editors and IDEs
To ease an integration of GoUnit with IDEs "gen" subcommand has a "-json" flag. When -json flag is passed GoUnit reads JSON requests from Stdin in a loop and produces JSON responses with generated test(s) that are written to Stdout. Using this mode you can generate as many tests as you want by running GoUnit executable only once.
*Note that all licence references and agreements mentioned in the gounit README section above are relevant to that project's source code only.