Skip to main content

Mutations

Stryker supports a variety of mutators, which are listed below. In parentheses the names of correspondent mutations are specified, which you might need for the exclude-mutations section of the configuration.

Do you have a suggestion for a (new) mutator? Feel free to create an issue!

Arithmetic Operators (arithmetic)​

OriginalMutated
+-
-+
*/
/*
%*

Equality Operators (equality)​

OriginalMutated
><
>>=
>=<
>=>
<>
<<=
<=>
<=<
==!=
!===
isis not
is notis

Logical Operators (logical)​

OriginalMutated
&&||
||&&
^==
andor
orand

Boolean Literals (boolean)​

OriginalMutated
truefalse
falsetrue
!person.IsAdult()person.IsAdult()
if(person.IsAdult())if(!person.IsAdult())
while(person.IsAdult())while(!person.IsAdult())

Assignment Statements (assignment)​

OriginalMutated
+=-=
-=+=
*=/=
/=*=
%=*=
<<=>>=
>>=<<=
&=|=
&=^=
|=&=
|=^=
^=|=
^=&=
??==

Initialization (initializer)​

OriginalMutated
new int[] { 1, 2 };new int[] { };
int[] numbers = { 1, 2 };int[] numbers = { };
new List<int> { 1, 2 };new List<int> { };
new Collection<int> { 1, 2 };new Collection<int> { };
new Dictionary<int, int> { { 1, 1 } };new Dictionary<int, int> { };
new SomeClass { Foo = "Bar" };new SomeClass { };

Removal mutators (statement, block)​

OriginalMutated
void Function() { Age++; }void Function() {} (block emptied)
int Function() { Age++; return Age; }void Function() { return default; } (block emptied)
return;removed
return value;removed
break;removed
continue;removed
goto;removed
throw;removed
throw exception;removed
yield return value;removed
yield break;removed
MyMethodCall();removed

Unary Operators (unary)​

OriginalMutated
-variable+variable
+variable-variable
~variablevariable

Update Operators (update)​

OriginalMutated
variable++variable--
variable--variable++
++variable--variable
--variable++variable

Checked Statements (checked)​

OriginalMutated
checked(2 + 4)2 + 4

Linq Methods (linq)​

OriginalMutated
SingleOrDefault()Single()
Single()SingleOrDefault()
FirstOrDefault()First()
First()FirstOrDefault()
Last()First()
All()Any()
Any()All()
Skip()Take()
Take()Skip()
SkipWhile()TakeWhile()
TakeWhile()SkipWhile()
Min()Max()
Max()Min()
Sum()Max()
Count()Sum()
Average()Min()
OrderBy()OrderByDescending()
OrderByDescending()OrderBy()
ThenBy()ThenByDescending()
ThenByDescending()ThenBy()
Reverse()AsEnumerable()
AsEnumerable()Reverse()
Union()Intersect()
Intersect()Union()
Concat()Except()
Except()Concat()
MinBy()MaxBy()
MaxBy()MinBy()
SkipLast()TakeLast()
TakeLast()SkipLast()
Order()OrderDescending()
OrderDescending()Order()
UnionBy()IntersectBy()
IntersectBy()UnionBy()

String Literals (string)​

OriginalMutated
"foo"""
"""Stryker was here!"
$"foo {bar}"$""
@"foo"@""
string.Empty"Stryker was here!"
string.IsNullOrEmpty(x)(x != null)
string.IsNullOrEmpty(x)(x != "")
string.IsNullOrWhiteSpace(x)(x != null)
string.IsNullOrWhiteSpace(x)(x != "")
string.IsNullOrWhiteSpace(x)(x.Trim() != "")

Bitwise Operators (bitwise)​

OriginalMutated
<<>>
>><<
&|
|&
a^b~(a^b)

Regular Expressions (regex)​

For the full list of all available regex mutations, see the regex mutator docs.

Math Methods (math)​

OriginalMutated
Acos()Acosh()
Acos()Asin()
Acos()Atan()
Acosh()Acos()
Acosh()Asinh()
Acosh()Atanh()
Asin()Asinh()
Asin()Acos()
Asin()Atan()
Asinh()Asin()
Asinh()Acosh()
Asinh()Atanh()
Atan()Atanh()
Atan()Acos()
Atan()Asin()
Atanh()Atan()
Atanh()Acosh()
Atanh()Asinh()
BitDecrement()BitIncrement()
BitIncrement()BitDecrement()
Ceiling()Floor()
Cos()Cosh()
Cos()Sin()
Cos()Tan()
Cosh()Cos()
Cosh()Sinh()
Cosh()Tanh()
Exp()Log()
Floor()Ceiling()
Log()Exp()
Log()Pow()
MaxMagnitude()MinMagnitude()
MinMagnitude()MaxMagnitude()
Pow()Log()
ReciprocalEstimate()ReciprocalSqrtEstimate()
ReciprocalSqrtEstimate()ReciprocalEstimate()
ReciprocalSqrtEstimate()Sqrt()
Sin()Sinh()
Sin()Cos()
Sin()Tan()
Sinh()Sin()
Sinh()Cosh()
Sinh()Tanh()
Tan()Tanh()
Tan()Cos()
Tan()Sin()
Tanh()Tan()
Tanh()Cosh()
Tanh()Sinh()

Null-coalescing Operators (nullcoalescing)​

OriginalMutated
a ?? bb ?? a
a ?? ba
a ?? bb