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
0
votes
0 answers

Why pytest runner hammett not support pytest_mock?

Pytest version = 6.0.1 Pytest-mock version = 3.6.1 Hammett version = 0.9.2 Python version = 3.9.2 When I try to run the test cases by using hammett getting the below error missing 1 required positional argument: 'mocker' After this I added some…
Lavanya
  • 65
  • 1
  • 12
0
votes
1 answer

Warnings importing PITEST reports into Sonarqube

Sorry for the cross posting: https://community.sonarsource.com/t/importing-mutation-tests-with-pitest/52285/3 I am very new to Sonarqube and QA and I am making sure the code (and unit tests) a contractor is providing is of a good quality. I am…
miguelgc
  • 26
  • 3
0
votes
1 answer

How can I force pit to use a particular junit version

I am using pit 1.6.7 and I want to use JUnit 4.12, but it looks like pit is always using junit 3.8.1 even junit 4.12 is in the dependency. How can I force PIT to use junit 4.12 in the maven pom file.
0
votes
2 answers

pitest report can't mix JUnit 4 and JUnit 5 tests

Recently, I introduced Pitest as the mutation testing tool to our team to diagnose test quality, and we loved it. In our codebase, we have lots of preexisting JUnit 4, and now we're writing all of our new unit tests in JUnit 5. Unfortunately, even…
Hamza Belmellouki
  • 2,516
  • 1
  • 18
  • 39
0
votes
1 answer

Problem with mutation testing of expressjs app (Stryker mutator)

I have made an express app which is basically an RESTAPI and I have written tests in mocha for the application. Now I wanted to mutation test my app but I've run into a problem. My app listens to the port 8000 via the app.listen(8000) command of…
0
votes
1 answer

How to kill "Changed conditional boundary" mutant - for loop?

I perform mutation testing, and on this line for(i=0;i<100;i++) is created a mutant "Changed conditional boundary". I know that the operator '<' is changed to '<='. My question is how can I kill this mutant? In addition is the whole for…
Programmer2B
  • 552
  • 3
  • 14
0
votes
1 answer

JS array mutation

Why does the first function mutate originalArr (although I created copyArr to perform methods only on that copy)? And why doesn't the second function mutate originalArr? function removeSmallest(originalArr) { const copyArr = originalArr; …
0
votes
2 answers

How to know if test was killed by Junit assertion error in PIT Mutation testing

I am using PIT mutation testing (1.6.7) and a maven build system. There is information on which test killed the mutants. But, what I need is whether the mutants were killed by JUnit assertion violation or by any implicit checks or run-time system?…
0
votes
0 answers

PiTest Mutation Coverage-Not able to kill the conditional boundary

I am trying to kill a conditional Mutation, below is my code public String check(Integer value) { String valueStr = String.valueOf(value); String value2; if (valueStr.length() > 2) { value2 =…
Thejas
  • 379
  • 5
  • 24
0
votes
0 answers

Mutation undetected if list is lower than 8

Recently I started doing some C#, coming from PHP. My way of playing with the language and learn is to do some TDD. So i grabbed some RFC spec and wrote some tests (RFC spec here). I'm using NUnit right now, and Stryker to check tests…
AR7CORE
  • 268
  • 1
  • 8
0
votes
1 answer

Running `mut.py` Opens Said File Instead of Running MutPy

I created a project that follows the example in MutPy's README file. However, when I run mut.py --target calculator --unit-test test_calculator -m, it just opens mut.py instead of actually running MutPy. The file has the following…
Floating Sunfish
  • 4,920
  • 5
  • 29
  • 48
0
votes
2 answers

Stryker initial run times out

Running simply "stryker run", mutations are being created and everything seems to run smoothly, until i receive the error that the dry run failed: 22:19:29 (12628) DEBUG JestTestRunner Running jest with --findRelatedTests flag. Set…
Alex Vulchev
  • 201
  • 1
  • 2
  • 15
0
votes
0 answers

Type org.pitest.maven.PitMojo not present

I am using java 1.7, maven 3.6.3, I have added the PIT plugin to do some mutation testing. However, getting the below issue. AFAIK, PIT will work for java 5 or above, but here I am getting Caused by: java.lang.UnsupportedClassVersionError:…
0
votes
0 answers

Need help understanding why a negated conditional survived in Pitest

According to the Pitest report, the following negated conditional has survived Why I find this odd is because I have 2 unit tests, one testing condition where channelType does equal WEB and another unit test where channelType equals MOBILE. What am…
Steve B
  • 557
  • 2
  • 7
  • 23
0
votes
1 answer

Unnecessary null check in mapstruct

I'm using mapstruct in my project, and recently went to add some 'mutation analysis' using pitest. The problem I have is that a mutant is created on some generated code, and I cannot fix my test to kill it since this is concerning null check…
baraber
  • 3,296
  • 27
  • 46