Logo

0x5a.live

for different kinds of informations and explorations.

GitHub - hexdigest/gounit: Unit tests generator for Go programming language

Unit tests generator for Go programming language. Contribute to hexdigest/gounit development by creating an account on GitHub.

Visit SiteGitHub - hexdigest/gounit: Unit tests generator for Go programming language

GitHub - hexdigest/gounit: Unit tests generator for Go programming language

Unit tests generator for Go programming language. Contribute to hexdigest/gounit development by creating an account on GitHub.

Powered by 0x5a.live ๐Ÿ’—

GoUnit License Build Status Coverage Status Go Report Card GoDoc

GoUnit is a commandline tool that generates tests stubs based on source function or method signature.

There are plugins for

Demo

demo

Installation

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 

Run 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.

GoLang Resources

are all listed below.

Resources

listed to get explored on!!

Made with โค๏ธ

to provide different kinds of informations and resources.