Questions tagged [pitest]

PIT is a fast bytecode-based mutation testing system for Java.

PIT is a state of the art mutation testing system, providing gold standard test coverage for Java and the jvm. It's fast, scalable and integrates with modern test and build tooling (Gradle, Maven, IntellJ IDEA, Eclipse ...).

What is a mutation?
A mutation is a piece of code added or modified in an application code base.

What is mutation testing?
A mutation (fault) can create side effects or not at all. Those side effects can be detected (ie fault killed) by the application tests suite or not. The more faults killed by the application tests suite, the better the suite is. However, when a fault keeps living, here comes mutation testing.

How does PIT mutation testing work?
It detects whether each statement is meaningfully tested by running unit tests against automatically modified versions of the application code. PIT chooses and prioritises tests based on three factors: Line coverage, Test execution speed and Test naming convention.

More details: http://pitest.org, http://pitest.org/faq

165 questions
1
vote
1 answer

Java 8 to Java 17 migration + pitest failing - Mutation testing requires a green suite

Recently , the project has been migrated from Java8 to Java17 . The mutation test coverage is also checked for the project and before migration there was no known issues during the command run of mvn clean install…
RagaSGNur
  • 199
  • 1
  • 2
  • 15
1
vote
1 answer

Pitest gradle, low coverage due to @Data

I tried to get a good coverage file in my java spring project, I mean; see where my tests are good and where they are not. But my problem is that @Data generate a lot of function/class that I don't want to test, and just ruin my coverage. I already…
Arthur
  • 23
  • 2
1
vote
1 answer

Pitest - Test Coverage Report Data

I understand that when outputting the test coverage report from Pitest, you are presented with the following structure:
Jack Johns
  • 59
  • 7
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

How to configure timezone in Maven so Pitest picks it up

I try to apply Pitest to an older project that relies on timezone settings. Some tests are specifically for daylight-saving issues, when certain days in a year have more or less than 24 hours in local time. I cannot change the code or the…
Lynax
  • 117
  • 1
  • 11
1
vote
1 answer

Is it possible to exclude methods from PIT coverage calculation?

My Java project contains a class of this form: public final class NotInstantiableClass { private NotInstantiableClass () { } // some utility functions } The constructor of this class cannot be invoked. Its sole purpose is to prevent…
Florian
  • 4,821
  • 2
  • 19
  • 44
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
1 answer

Pitest mutates Java source code in ways that seem not possible

I wrote a simple program that given three integers representing the lengths of the sides of a triangle, outputs which type of triangle it is. Then I wrote a set of test cases and ran mutation coverage using pitest. My goal is to obtain a 100%…
bustharime
  • 27
  • 5
1
vote
0 answers

OutOfMemoryError: pittest mutation testing

I want to generate a mutation testing report for my module (I have 225 classes in my module) using pitest. I've added the needed dependencies and configured the plugin. The problem is when I run the maven goal mvn…
Hamza Belmellouki
  • 2,516
  • 1
  • 18
  • 39
1
vote
1 answer

How to kill a conditional boundary mutation concerning time

I'm trying to test the following class @Component public class StreamListener { @Value("${kafkaMessageExpiration.maxExpirationInMilliseconds}") private long messageExpirationTime; public void handleMessage(Payment payment) { …
Steve B
  • 557
  • 2
  • 7
  • 23
1
vote
1 answer

Mutation Test Coverage fails when mock static method

I'm trying to get the mutation coverage of unit test but getting weird exception from pitest: 7:55:09 PM PIT >> INFO : MINION : 7:55:09 PM PIT >> SEVERE : Error calculating coverage. Process will exit. java.lang.ExceptionInInitializerError …
fywe
  • 433
  • 1
  • 7
  • 17
1
vote
0 answers

Unable to cover if conditions in pitest

I have added two conditions in code: n the code if gets covered properly, however I am not able to cover the else if part public Optional < Flavors > callIcecream() { try { if (icecream == 1) { //do something …
Shruti Joshi
  • 301
  • 1
  • 4
  • 16
1
vote
0 answers

Where to put the PIT mutation testing history file?

Where do I put the PIT mutation testing history file so that a new Jenkins job picks it up? Because when I build on Jenkins, the job starts every time on an entirely new workspace without any previous analysis history, which results in a looooong…
Amedee Van Gasse
  • 7,280
  • 5
  • 55
  • 101
1
vote
1 answer

what is the different between default, stronger and all operators in Pitclipse?

I was using PITclipse on Eclipse to run PIT mutation tests on code. There are three type of operators in PITclipse: DEFAULT, STRONGER and ALL). What is the different between them and the list of mutants listed in each operator?
Samah wa
  • 41
  • 5
1
vote
1 answer

Pitest not running with Kotlintest tests

I'm using kotlintest in my projects and I want to run mutation testing with pitest. Already tried using pitest alone and with junit5 plugin, but the result is always: Found 0…