Skip to contents

A quiet reporter that writes a machine-readable JSON artifact. It prints nothing while running; on completion it writes one JSON file describing every mutant, keyed by source file. The JSON is the data contract consumed by dashboards, CI job summaries, and the HTML report (see report()).

Combine it with ProgressMutationReporter via MultiReporter to get a live console display and a JSON file from the same run.

Super class

muttest::MutationReporter -> JSONMutationReporter

Public fields

path

Path of the JSON file to write.

mutants_by_file

Per-file lists of mutant records.

sources

Per-file original source lines.

Methods

Inherited methods


Method new()

Initialize a new JSON reporter

Usage

JSONMutationReporter$new(path = "muttest.json", ...)

Arguments

path

Path of the JSON file to write (default: "muttest.json").

...

Passed to the MutationReporter constructor.


Method start_reporter()

Start reporter

Usage

JSONMutationReporter$start_reporter(plan = NULL)

Arguments

plan

The complete mutation plan


Method add_result()

Add a mutation test result

Usage

JSONMutationReporter$add_result(
  plan,
  killed,
  survived,
  no_coverage,
  errors,
  error = NULL,
  original_code = NULL,
  mutated_code = NULL
)

Arguments

plan

Current testing plan. See muttest_plan().

killed

Whether the mutation was killed by tests

survived

Number of survived mutations

no_coverage

Number of mutants with no test coverage

errors

Number of errors encountered

error

Optional error condition from a failed run

original_code

Original source lines before mutation

mutated_code

Mutated source lines


Method end_reporter()

End reporter, then write the JSON file

Usage

JSONMutationReporter$end_reporter()


Method clone()

The objects of this class are cloneable with this method.

Usage

JSONMutationReporter$clone(deep = FALSE)

Arguments

deep

Whether to make a deep clone.