Skip to contents

The job of a mutation reporter is to aggregate and display the results of mutation tests. It tracks each mutation attempt, reporting on whether the tests killed the mutation or the mutation survived.

See also

Other MutationReporter: ProgressMutationReporter, default_reporter()

Public fields

test_reporter

Reporter to use for the testthat::test_dir function

out

Output destination for reporter messages

width

Width of the console in characters

unicode

Whether Unicode output is supported

crayon

Whether colored output is supported

rstudio

Whether running in RStudio

hyperlinks

Whether terminal hyperlinks are supported

current_file

Path of the file currently being mutated

current_mutator

Mutator currently being applied

plan

Complete mutation plan for the test run

results

List of mutation test results, indexed by file path

current_score

Current score of the mutation tests

Methods


Method new()

Initialize a new reporter

Usage

MutationReporter$new(test_reporter = "silent", file = stdout())

Arguments

test_reporter

Reporter to use for the testthat::test_dir function

file

Output destination (default: stdout)


Method start_reporter()

Start reporter

Usage

MutationReporter$start_reporter(plan = NULL)

Arguments

plan

The complete mutation plan

temp_dir

Path to the temporary directory for testing


Method start_file()

Start testing a file

Usage

MutationReporter$start_file(filename)

Arguments

filename

Path to the file being mutated


Method start_mutator()

Start testing with a specific mutator

Usage

MutationReporter$start_mutator(mutator)

Arguments

mutator

The mutator being applied


Method add_result()

Add a mutation test result

Usage

MutationReporter$add_result(plan, killed, survived, errors)

Arguments

plan

Current testing plan. See plan().

killed

Whether the mutation was killed by tests

survived

Number of survived mutations

errors

Number of errors encountered


Method end_mutator()

End testing with current mutator

Usage

MutationReporter$end_mutator()


Method end_file()

End testing current file

Usage

MutationReporter$end_file()


Method end_reporter()

End reporter and show summary

Usage

MutationReporter$end_reporter()


Method get_score()

Get the current score

Usage

MutationReporter$get_score()


Method cat_tight()

Print a message to the output

Usage

MutationReporter$cat_tight(...)

Arguments

...

Message to print


Method cat_line()

Print a message to the output

Usage

MutationReporter$cat_line(...)

Arguments

...

Message to print


Method rule()

Print a message to the output with a rule

Usage

MutationReporter$rule(...)

Arguments

...

Message to print


Method clone()

The objects of this class are cloneable with this method.

Usage

MutationReporter$clone(deep = FALSE)

Arguments

deep

Whether to make a deep clone.