FileTestStrategy: Run tests matching the mutated source file name

FileTestStrategyR Documentation

Run tests matching the mutated source file name

Description

This strategy tells if a mutant is caught by a test matching the source file name.

For example, if the source file name is foo.R, and there are test files named test-foo.R or test-bar.R, only test-foo.R will be run.

This strategy should give faster results than ?FullTestStrategy, especially for big codebases, but the score might be less accurate.

Super class

muttest::TestStrategy -> FileTestStrategy

Methods

Public methods


Method new()

Initialize the FileTestStrategy

Usage
FileTestStrategy$new(
  load_helpers = TRUE,
  load_package = c("source", "none", "installed")
)
Arguments
load_helpers

Whether to load test helpers

load_package

The package loading strategy


Method execute()

Execute the test strategy

Usage
FileTestStrategy$execute(path, plan, reporter)
Arguments
path

The path to the test directory

plan

The current mutation plan. See muttest_plan().

reporter

The reporter to use for test results

Returns

The test results


Method clone()

The objects of this class are cloneable with this method.

Usage
FileTestStrategy$clone(deep = FALSE)
Arguments
deep

Whether to make a deep clone.

See Also

Other TestStrategy: FullTestStrategy, TestStrategy, default_test_strategy()


muttest documentation built on May 14, 2026, 5:10 p.m.