gotests 0,0,0,1 travis-ci

Generate Go tests from your source code.

3 years after

gotests License godoc Build Status Coverage Status codebeat badge

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.

Demo

The following shows gotests in action using the official Sublime Text 3 plugin. Plugins also exist for Emacs and Atom Editor.

demo

Installation

Minimum Go version: Go 1.6

Use go get to install and update:

$ go get -u github.com/cweill/gotests/...

Usage

From the commandline, gotests can generate Go tests for specific source files or an entire directory. By default, it prints its output to stdout.

$ gotests [options] PATH ...

Available options:

  -all         generate go tests for all functions and methods

  -excl        regexp. generate go tests for functions and methods that don't 
               match. Takes precedence over -only, -exported, and -all

  -exported    generate go tests for exported functions and methods. Takes 
               precedence over -only and -all

  -i           print test inputs in error messages

  -only        regexp. generate go tests for functions and methods that match only.
               Takes precedence over -all

  -w           write output to (test) files instead of stdout

Contributions

Contributing guidelines are in CONTRIBUTING.md.

License

gotests is released under the Apache 2.0 License.

Related Repositories

vscode-go

vscode-go

An extension for VS Code which provides support for the Go language. ...

GoTests-Sublime

GoTests-Sublime

A Sublime Text 3 plugin for generating better Go tests ...

GoTests-Emacs

GoTests-Emacs

Emacs package for https://github.com/cweill/gotests ...

gotalks

gotalks

Go Examples and prepare talks documents, also they are seen via talks.godoc.org ...

gotests-vim

gotests-vim

Vim plugin for https://github.com/cweill/gotests ...


Top Contributors

cweill msoap

Releases

-   v1.4.0 zip tar
-   v1.3.0 zip tar
-   v1.2 zip tar
-   v1.1 zip tar
-   v1.0 zip tar
-   v1.0-beta zip tar