Questions tagged [mutation-testing]

A method of software testing that involves modifying the source code or compiled intermediate code (Java: byte code, .NET: IL). Test suites that do not fail under each of these "mutations" is considered to be inadequate.

Mutation testing is a method of testing the adequacy of test suites. By applying mutations to the code under test, the effectiveness of a test suite can be judged. If the test suite fails under this mutation, it is effective against it.

Different mutation types are used: Ma, Offutt and Kwon describe intra-method, inter-method, intra-class and inter-class mutations. The simplest to implement is intra-method mutation, for which some of the mutations that may be used are:

  • Statement deletion.
  • Replace each boolean subexpression with true and false.
  • Replace each arithmetic operation with another one, e.g. + with *, - and /.
  • Replace each boolean relation with another one, e.g. > with >=, == and <=.
  • Replace each variable with another variable declared in the same scope (variable types should be the same). (source: Wikipedia)
191 questions
2
votes
1 answer

Recompile with new class definition for mutation testing

I am trying to use openHFT/java-runtime-compiler to improve my mutation testing tools, from heavy use of disk-access to only use in-memory-compilation. In mutation testing, there was a two kind of class: A. the mutated class, a class that its…
2
votes
2 answers

Mutation killing

I am stuck at 1 point and need suggestions. While writing junit for my code I'm not able to kill the ValidateArgument.notNull(arg1) mutation !!! Need Suggestions. code follows as.. public class A{ public void method1(Object B){ …
CryoMancer
  • 23
  • 1
  • 4
2
votes
1 answer

How can I test correctness of a program by removing or replacing lines of code?

I know this question is very vague but I think with your help we can improve it. A couple of month ago in an interview talking about TDD and unit testing, I was asked if I knew I particular methodology (unfortunately I forgot the name) where a class…
Paolo Vigori
  • 1,612
  • 1
  • 18
  • 32
2
votes
1 answer

How to know if a project implemented mutation testing in SonarQube, programatically?

I am working on adding plug-ins to my company's SonarQube dashboard. They wanted me to put 2 labels on the dash board, The Total number of projects that have mutation testing and The projects that need Mutation testing. I am using SonarQube Java…
2
votes
1 answer

mutation testing reachability infection and propagation

Hey guys i have a question about mutation testing here is the sample code //Effects: If numbers null throw NullPointException // else return LAST occurance of val in numbers[] //If val not in numbers [] return -1   public static int findVal (int…
user5019310
2
votes
0 answers

Mutation testing using gulp for NodeJS

Is there any node module available for mutation testing using gulp similar to grunt-mutation-testing ? As I am using gulp task to report mutation coverage but don't find any material.
2
votes
0 answers

Clear instructions on how to integrate grunt-mutation-testing

I'm trying to use this mutation testing tool called grunt-mutation-testing, but with no success. It's unclear to me from the readme file (on GitHub, or npmjs) how the tool recognizes the test code, versus the production code. Moreover, I don't…
ethanfar
  • 3,733
  • 24
  • 43
1
vote
2 answers

Example open source projects built using maven and test with TestNG

I'm looking at adding TestNG support to http://pitest.org and could do with some real and dirty code to try it out on. Can anyone suggest some smallish open source projects that are build using maven and use TestNG for unit testing? For clarity - I…
henry
  • 5,923
  • 29
  • 46
1
vote
0 answers

Mutants were not covered by tests in PHP Infection

I'm running some mutation tests ("infection/infection": "^0.26.1") and for some unknown reason PHP Infection claims that there are tests that are not covered even with the unit tests written there. Here is the error alleged by Infection: 1)…
José Victor
  • 125
  • 10
1
vote
1 answer

Pitest - Mutation Test failure - negated conditional → SURVIVED

I added a conditional operator in my code like: String test;//assigned with some value result = test != null ? test : ""; This fails in mutation testing with the reason of negated conditional → SURVIVED I added few unit test cases to assign the…
RagaSGNur
  • 199
  • 1
  • 2
  • 15
1
vote
1 answer

Pie Mutation test fails : org.pitest.mutationtest.engine.gregor.mutators.EmptyObjectReturnValsMutator

While running mutation test , there are survived cases . The reason is org.pitest.mutationtest.engine.gregor.mutators.EmptyObjectReturnValsMutator The exact error message is : replaced return value with Collections.emptyList for…
RagaSGNur
  • 199
  • 1
  • 2
  • 15
1
vote
2 answers

Pitest is failing showing: No mutations found due to the supplied classpath or filters + Gradle

I'm trying to run a pitest report on a gradle + kotlin project, but I get the following error: Exception in thread "main" org.pitest.help.PitHelpError: No mutations found. This probably means there is an issue with either the supplied classpath or…
1
vote
0 answers

This version of the Android Support plugin for IntelliJ IDEA (or Android Studio) cannot open this project, please retry with version 2021.1.1 or newer

I am trying to use pitest plugin in a helloworld android studio project to do mutation testing. However after following the instruction it's giving following errors : This version of the Android Support plugin for IntelliJ IDEA (or Android Studio)…
ruben
  • 1,745
  • 5
  • 25
  • 47
1
vote
1 answer

How to incorporate Stryker.NET tool in Azure DevOps pipelines in case of multiple project dependencies in a test project?

I have a unit test project file which depends on two other projects. ABC.Service.UnitTest is the test project and its dependencies are XYZ.Service.csproj and LMN.Aggregator.csproj. In this case, what exactly do we need to have in our config file and…
1
vote
2 answers

How to mock local object property which is been set in another method

I have similar to below code in my application. public String someMethod(final Object obj) { final ValidationResponse validationResponse = new ValidationResponse(); String responseMessage = validatorService.validate(obj,…
mevada.yogesh
  • 1,118
  • 3
  • 12
  • 35