Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Mutation Test tools in C# [duplicate]

I am starting a new project in c# and I am looking for a tool that helps me do mutation tests. I have previously done mutation testing in java using pitest and liked it very much. Now I am looking for such a tool for C# and the only ones i can find are either not updated for the past few years or still in alpha/beta ( cream, ninjaTurtles, Nester).

Are there any tools available that are reliable and can be used with tools that came out after 2010?

EDIT: Some might say this question is a duplicate of What mutation-testing frameworks exist? [closed]. Only that question is currently 8 years old and most of the tools discussed there are not usable since most of them haven't been updated in the last 6 to 8 years.

like image 587
ziraak Avatar asked Sep 14 '16 10:09

ziraak


People also ask

What are mutation testing tools?

Mutation testing, also known as code mutation testing, is a form of white box testing in which testers change specific components of an application's source code to ensure a software test suite will be able to detect the changes. Changes introduced to the software are intended to cause errors in the program.

How do you test for a mutation?

Genetic testing looks at your genes to check for any mutations. The test is done with a sample of blood, saliva, or tissue. There are several reasons why you might do genetic testing. To diagnose a disease or a type of disease.

What is Stryker mutation testing?

Stryker offers mutation testing for your .NET Core and .NET Framework projects. It allows you to test your tests by temporarily inserting bugs in your source code. For an introduction to mutation testing and Stryker's features, see stryker-mutator.io.

What is mutation in C++?

Mutation of an object means changing its abstract value. This can happen in one of two ways: the object had a well-defined abstract value that is changed, or. the object had no well-defined abstract value, but it became well-defined.


Video Answer


1 Answers

I used with success the following Visual Studio 2013 extension: VisualMutator.Net. That's because other mutation tools needed Visual Studio 2005 in place or other uber obsolete software / frameworks / so on.

More here: http://visualmutator.github.io/web/

You will basically get a UI like the one below:

Tests that can be runned

TestingExample.Tests will be mutated. Probably you already have your project structured Project & Project.Tests You have access to the following list of mutans:

ISD (ISK) – Super/Base Keyword Deletion

Operator deletes a call for base class method in overloading method belonging to inheritance method.

DMC – Delegated Method Change

Operator changes a method of processing delegation into another one with similar signature.

DEH – Method Delegated for Event Handling Change

Operator changes a call adding or removing a method from error handling. EAM,

EMM – Accessors, Modifier Method Change

Operators change a call for class property into call for another property of the same type. EHR -

Exception Handler Removal

Operator removes catch block if there exists another catch or finally.

EHC – Exception Handling Change

Operator changes body of a catch block into throwing caught exception.

EXS – Exception Swallowing

Operator adds empty block catch(Exception e) so that no exception can leave current method.

JTI, JTD – This Keyword Insertion, Deletion

Operators add or remove this keyword if there exists local variable with the same name.

JID – Member Variable Initialization Deletion (Field Initialization Deletion) Operator deletes

initialisation of class's field with proper value.

MCI – Member Call from Another Inherited Class

Operator changes calling of a method on object into calling the same method on another object.

PRV - Reference Assignment with Other Compatible Type

Operator changes assigning certain object to references into assigning another compatible object.

Standard Operators:

AOR – Arithmetic Operator Replacement

Operator changes arithmetical operations (+, -, *, /, %) into another one from this group.

LOR – Logical Operator Replacement

Operator changes logical operations (&, |, ˆ) into another one from this group.

LCR – Logical Connector Replacement

Operator changes connector (,||) in logic expression into another one.

ROR – Relational Operator Replacement

Operator changes each relational operator (>, <, <=, >=, ==, !=) into another one from the same group.

SOR – Shift Operator Replacement

Operator changes logical shift (», «) into opposite one.

OODL – Operator Deletion

Operator creates two mutants from each operation such as +,-,>,<=,% etc. In one it removes operation

and what is on its left side, in the other one it removes operation and what is on its right side (e.g. from y=a+b; there will be following mutants : y=a; and y=b;).

SSDL – Statement Block Deletion

Operator removes statements and assignments, but not declarations (e.g. from int y=15; there will be following mutant: int y;).

And results are looking like the following:

Mutation score Mutation score

Not killed mutant Not killed mutant

Killed mutant Killed mutant

By the following tests

Killed mutant by the following

like image 63
Razvan Dumitru Avatar answered Oct 10 '22 03:10

Razvan Dumitru