gomutate

package module
v0.0.0-...-9a39b94 Latest Latest
Warning

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

Go to latest
Published: Feb 29, 2016 License: Apache-2.0 Imports: 17 Imported by: 0

README

Gomutate Build Status Coverage Status

A mutation testing tool for Go programs.

Gomutate was inspired by the Pitest tool used for mutation testing on the JVM.

Usage

Install the binary:

go get github.com/zabawaba99/gomutate/cmd/gomutate

Navigate to the directory of your project and run:

gomutate ./...

The above command will run the default mutations on all packages in your project.

Flags
Usage:
  gomutate [OPTIONS]

Application Options:
  -d, --debug    Show debug information
  -m, --mutator= The mutators to apply (conditionals-boundary)

Help Options:
  -h, --help     Show this help message

Available mutators

Mutation Tests

A chunk of the documentation below was taken from Pitest since they did a great job of explaining what mutation testing is and why you should do it.

What is mutation testing?

Mutation testing is conceptually quite simple.

Faults (or mutations) are automatically seeded into your code, then your tests are run. If your tests fail then the mutation is killed, if your tests pass then the mutation lived.

The quality of your tests can be gauged from the percentage of mutations killed.

What?

To put it another way - Gomutate runs your unit tests against automatically modified versions of your application code. When the application code changes, it should produce different results and cause the unit tests to fail. If a unit test does not fail in this situation, it may indicate an issue with the test suite.

Why?

Traditional test coverage (i.e line, statement, branch etc) measures only which code is executed by your tests. It does not check that your tests are actually able to detect faults in the executed code. It is therefore only able to identify code the is definitely not tested.

The most extreme example of the problem are tests with no assertions. Fortunately these are uncommon in most code bases. Much more common is code that is only partially tested by its suite. A suite that only partially tests code can still execute all its branches.

As it is actually able to detect whether each statement is meaningfully tested, mutation testing is the gold standard against which all other types of coverage are measured.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AST

type AST struct {
	// contains filtered or unexported fields
}

func (*AST) ApplyMutation

func (a *AST) ApplyMutation(m mutants.Mutator)

type Gomutate

type Gomutate struct {
	// contains filtered or unexported fields
}

func New

func New(wd string) *Gomutate

func (*Gomutate) GatherResults

func (g *Gomutate) GatherResults()

func (*Gomutate) Run

func (g *Gomutate) Run(pkg string, mutations []mutants.Mutator)

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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