go-test-gen

command module
v1.0.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 26, 2024 License: GPL-3.0 Imports: 1 Imported by: 0

README

Go Test Generator (AKA go-test-gen)

This CLI enables to create automatically tests skeletons for your Golang projects.

CI Lines of Code Reliability Rating Security Rating Maintainability Rating

Installation

To install this CLI in your global environment, you can use the following command :

    go install github.com/dterbah/go-test-gen

Usages

The command to generate test of your project is the following one :

    # Create tests skeleton for a project
    go-test-gen generate --project="/path/to/golang/project"
    # or
    go-test-gen generate -p="/path/to/golang/project"

    # Create tests for a single go file
    go-test-gen generate --file="path/to/file"
    # or
    go-test-gen generate -f="path/to/file"

This command will automatically create tests for all your .go files. If a test already exists for a file, it will take all the current content of your file and update it with the missing tests.

Configuration of CLI (for project)

You can configure the CLI via a .go-test-gen.json in the root of your project. Here are the different options you can use :

Option Type Description Default value
generatePrivateFunctions bool Defines if the CLI has to create tests for private functions false
generateEmptyTests bool Defines if the CLI has to create file tests for empty go files or go files without any functions false
excludeFiles []string Defines files to that not need to have attached test. For example, you can have ["main.go", "*_config.go"] []
verbose bool If this option is false, you will have less logs than usually true

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
core
examples

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL