Getting started
Install
Section titled “Install”Mutato ships as a .NET global tool. Because .NET 10 packaging is
platform-specific, the tool is installed per RID behind the dotnet-mutato
manifest package:
dotnet tool install -g dotnet-mutato --prereleaseThe optional test-side hooks live in a separate package (see Cooperative hooks):
# added for you by `mutato init`, or reference it manuallydotnet add test/YourProject.Tests package Mutato.Testing --prereleaseBuild from source
Section titled “Build from source”To run against the current source tree instead of a published package:
git clone https://github.com/slang25/mutation-testing-playcd mutation-testing-play
dotnet pack src/Mutato.Cli -c Release # -> artifacts/dotnet-mutato.<rid>.*.nupkgdotnet pack src/Mutato.Testing -c Release # -> artifacts/Mutato.Testing.*.nupkg (+ Runtime)dotnet tool install -g --add-source artifacts dotnet-mutato --prereleaseRun it
Section titled “Run it”From the root of the repository you want to test:
mutato init # discover the target/test pair, add the Mutato.Testing hooks, # and write a mutation-config.jsonmutato # your first mutation scoremutato also works without init — the hooks package is optional, and
there is nothing to deploy alongside your tests: the runtime is compiled into
the instrumented target as injected source.
With no --project/--tests, Mutato reads ./mutation-config.json if present,
otherwise auto-discovers the target and test project pair under the current
directory (preferring test projects that reference Mutato.Testing).
Explicit invocation
Section titled “Explicit invocation”You can also point Mutato at specific projects and narrow what it mutates:
mutato \ --project src/Polly.Core/Polly.Core.csproj \ --tests-project test/Polly.Core.Tests/Polly.Core.Tests.csproj \ --filter Polly.Retry.RetryHelper \ --workers 4 \ --json report.json \ --html report.html--filterscopes mutation to a type or namespace prefix — start narrow.--tests-projectbuilds the test project and locates its assembly; pass a prebuilt--tests <tests.dll>to skip the build.--json/--htmlemit a Stryker-schema report you can open in the standard viewer.
See Configuration for the full set of options and the
mutation-config.json file format.
From MSBuild
Section titled “From MSBuild”If your test project references the Mutato.Testing package, a run is also
available as an MSBuild target:
dotnet build test/YourProject.Tests /t:Mutate