gooze run

Runs mutation testing and writes reports. This is the main command.

Usage

gooze run [global flags] [paths...]

With no paths, run defaults to ./... (the current module, recursively), so gooze run is the same as gooze run ./....

What it does (high level)

  1. Generates mutations for a source file.
  2. Applies one mutation.
  3. Runs tests to see if they fail.
  4. Writes results into the reports directory.

Preview with --estimate

See which source files would be mutated and how many mutations apply, without running any tests. This is a safe first command.

gooze run --estimate ./...

Scan only one sub-tree:

gooze run --estimate ./internal/domain/...

In a TTY you get an interactive, filterable list; in CI you get a table with per-file mutation counts.

Parallel workers

Run faster by using multiple workers:

gooze run -p 4 ./...

This example runs up to 4 mutations at the same time.

Timeouts

Gooze stops a mutation test if it takes too long. In some versions you can configure this with a flag. Check your version with gooze run --help.

gooze run --help

If you see many suspicious failures, run verbose and inspect logs:

gooze run --verbose ./...

Caching / incremental runs

Gooze can reuse stored reports if nothing changed. To force a full re-run:

gooze run --no-cache ./...

Coverage profile (skip uncovered mutations)

Pass an existing Go coverage profile with --coverage-profile to skip mutations on lines your tests never execute. Gooze does not generate the profile; produce it first with go test -coverprofile.

# 1. Generate a coverage profile with the Go toolchain
go test -coverprofile=coverage.out ./...

# 2. Run gooze, skipping mutations on uncovered lines
gooze run --coverage-profile coverage.out ./...

Before testing each mutation, Gooze checks whether the mutated line is covered by the profile. If the line is not covered (or its file is absent from the profile), Gooze reports the mutation as not_covered and skips running its tests. Uncovered mutations can never be killed, so this is a large speed-up.

A not_covered mutation counts as a survivor in the mutation score (it lowers the score like survived) but is tallied separately. The default is empty, which disables the feature. You can also set it via run.coverage_profile in gooze.yaml or GOOZE_RUN_COVERAGE_PROFILE.

Sharding (CI)

Sharding splits the work across jobs. Example with 3 jobs:

gooze run -s 0/3 ./...
gooze run -s 1/3 ./...
gooze run -s 2/3 ./...

After all jobs finish, merge reports:

gooze report merge