Mutation Testing is a type of Software Testing that is performed to design new software tests and also evaluate the quality of already existing software tests.
Mutation testing is a way to measure the effectiveness of unit tests.
Bugs, or mutants, are automatically inserted into your production code. Your tests are run for each mutant. If your tests fail then the mutant is killed. If your tests passed, the mutant survived. The higher the percentage of mutants killed, the more effective your tests are.
It validates and check the quality of your tests by introducing changes into your code and seeing if your test suite detects them.
You can do Mutation Testing in .NET via Stryker.NET library
dotnet tool install -g dotnet-stryker
To execute mutation tests we need:
- Open Console or PowerShell.
- Open folder with our Unit Tests.
- Type
dotnet stryker
command.