mutannot 0.7.0

There is a newer version of this package available.
See the version list below for details.
dotnet tool install --global mutannot --version 0.7.0
                    
This package contains a .NET tool you can call from the shell/command line.
dotnet new tool-manifest
                    
if you are setting up this repo
dotnet tool install --local mutannot --version 0.7.0
                    
This package contains a .NET tool you can call from the shell/command line.
#tool dotnet:?package=mutannot&version=0.7.0
                    
nuke :add-package mutannot --version 0.7.0
                    

mutannot

mutannot on NuGet Mutannot.Annotations on NuGet

This will let you write the mutations that should cause a test to fail directly into your test code.

It can help you make sure that a test actually tests what you think that it is testing, and that the test isn't just turning green for some other reason (for example because it goes down a different branch entirely that just happens to lead to the expected result, or because the assertions are too weak to discover anything).

Currently, only .NET is supported.

Installation

mutannot is a .NET tool and requires the .NET 10 SDK.

Install it globally:

dotnet tool install --global mutannot

Or add it to your repository's tool manifest:

dotnet tool install mutannot

Usage

You add the Mutannot.Annotations NuGet package to your test project (or add a copy of the attribute manually if you prefer to not have a dependency), and then you annotate tests with git patches which, when applied, should cause the test to fail:

open Xunit
open Mutannot.Annotations

[<Fact>]
[<ShouldCatch("""
--- a/Example/Validator.fs
+++ b/Example/Validator.fs
@@ -3,4 +3,4 @@ namespace Example
 open System

 module Validator =
-    let isAllowed (now: DateTime) (date: DateTime) = now.Date <= date
+    let isAllowed (now: DateTime) (date: DateTime) = now <= date
""")>]
member _.``You're allowed to pick the current day``() =
    let now = DateTime(2026, 5, 12, 17, 17, 13)
    let date = DateTime(2026, 5, 12)
    Assert.True (Validator.isAllowed now date)

To run your mutations, you use dotnet tool run mutannot -- run [path/to/testproject.csproj|fsproj]. It will do a control run of the original test cases, and then it will run the same tests again with the patches applied, to confirm that they now fail. Doing so takes a while, so if you just want to quickly check if your git patches are (still) technically valid without running the mutation, use dotnet tool run mutannot -- validate [path/to/directory|path/to/testfile.cs|path/to/testfile.fs].

Use dotnet tool run mutannot -- --help to list all commands and options.

Examples

A simple C# example is available here, and a simple F# example is available here.

Mutannot is also heavily dogfooded, however, so you can find a lot more examples in the program's own integration tests.

Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

This package has no dependencies.

Version Downloads Last Updated
0.12.0 2,499 8/9/2026
0.11.0 543 8/3/2026
0.10.0 111 8/2/2026
0.9.0 122 7/31/2026
0.8.0 110 7/30/2026
0.7.1 111 7/26/2026
0.7.0 746 7/24/2026
0.6.0 100 7/23/2026
0.5.0 107 7/23/2026
0.4.0 667 7/14/2026
0.3.0 110 7/10/2026
0.2.0 116 7/9/2026
0.1.0 112 7/9/2026