pitest | State of the art mutation testing system for the JVM | Testing library

 by   hcoles Java Version: 1.15.7 License: Apache-2.0

kandi X-RAY | pitest Summary

kandi X-RAY | pitest Summary

pitest is a Java library typically used in Institutions, Learning, Administration, Public Services, Testing, Spring Boot applications. pitest has build file available, it has a Permissive License and it has high support. However pitest has 59 bugs and it has 1 vulnerabilities. You can download it from GitHub, Maven.

Pitest (aka PIT) is a state of the art mutation testing system for Java and the JVM. Read all about it at
Support
    Quality
      Security
        License
          Reuse

            kandi-support Support

              pitest has a highly active ecosystem.
              It has 1525 star(s) with 337 fork(s). There are 59 watchers for this library.
              There were 7 major release(s) in the last 6 months.
              There are 320 open issues and 429 have been closed. On average issues are closed in 510 days. There are 12 open pull requests and 0 closed requests.
              OutlinedDot
              It has a negative sentiment in the developer community.
              The latest version of pitest is 1.15.7

            kandi-Quality Quality

              OutlinedDot
              pitest has 59 bugs (4 blocker, 4 critical, 35 major, 16 minor) and 1450 code smells.

            kandi-Security Security

              pitest has no vulnerabilities reported, and its dependent libraries have no vulnerabilities reported.
              OutlinedDot
              pitest code analysis shows 1 unresolved vulnerabilities (1 blocker, 0 critical, 0 major, 0 minor).
              There are 23 security hotspots that need review.

            kandi-License License

              pitest is licensed under the Apache-2.0 License. This license is Permissive.
              Permissive licenses have the least restrictions, and you can use them in most projects.

            kandi-Reuse Reuse

              pitest releases are available to install and integrate.
              Deployable package is available in Maven.
              Build file is available. You can build the component from source.
              It has 66742 lines of code, 7945 functions and 1041 files.
              It has low code complexity. Code complexity directly impacts maintainability of the code.

            Top functions reviewed by kandi - BETA

            kandi has reviewed pitest and discovered the below as its top functions. This is intended to give you an instant insight into pitest implemented functionality, and help decide if they suit your requirements.
            • Returns the property value .
            Get all kandi verified functions for this library.

            pitest Key Features

            No Key Features are available at this moment for pitest.

            pitest Examples and Code Snippets

            No Code Snippets are available at this moment for pitest.

            Community Discussions

            QUESTION

            Pitest targetClasses doesn't retrieve path by ${tests}
            Asked 2022-Mar-03 at 11:21

            I don't understand what is happening here. I made a property (test) that has path value as ${currentdirectory.@{targetClasses}} (which stores value of "org.apache.commons.lang3") when I try to give targetClasses its value i use ${test} but it gives me error at $ in property. Does Pitest not allow values to be retrieved.

            Error:

            ...

            ANSWER

            Answered 2022-Mar-03 at 11:21

            I changed the name from "currentdirectory.@{targetClasses}" to "tests". Now it works in targetTests with "${tests}.*"

            Source https://stackoverflow.com/questions/71331408

            QUESTION

            How to run Pitest with Mockito static mocking?
            Asked 2021-Nov-21 at 11:05

            A project I am working on involves updating our codebase to JUnit 5. A number of our test classes had previously been using PowerMockito for static mocking. As PowerMockito does not currently support JUnit 5, we updated our Mockito dependency and switched to using Mockito's static mocking. This works for the most part when running the unit tests but has issues when the tests are run with pitest to get mutation coverage.

            Despite the tests running and passing fine with mvn test or mvn verify, pitest will give the error:

            ...

            ANSWER

            Answered 2021-Nov-21 at 11:05

            Pitest does not currently support static mocking with mockito. I'll see if it could be supported, but it likely to be a complex task. Support for Powermock required dark magics (rewriting the bytecode of the bytcode manipulation library it uses), and was always brittle and easily broken by new Powermock releases.

            A better long term solution would be to remove the need for static mocking from the test suite. Although it does have some use cases, it is most often a red flag for design issues.

            Source https://stackoverflow.com/questions/69455779

            QUESTION

            Pitest mutates Java source code in ways that seem not possible
            Asked 2021-Nov-05 at 12:21

            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% mutation coverage which I think is doable since it is a very simple program.

            My problem is that pitest introduces mutations that I don't understand and thus don't know how to kill.

            Here is the program:

            ...

            ANSWER

            Answered 2021-Nov-05 at 08:21

            Pitest mutates bytecode rather than source code. The mutators attempt to describe the equivalent change in the source file, but sometimes this is less than straightforward.

            These mutations look to have been generated by the 'rv' mutators. These are generally of lower quality than the standard set and are not reccomended for general use. Do not use them unless you have a particular reason to do so.

            The "incremented a local variable" should really read "incremented a the local variable or paramter". The operator would need to do additional analysis to work out which.

            The not equal to greater than mutation will have mutated a IFNE instruction in the bytecode. In the simplest case this will map to a != check as the mutation description suggests, but the compiler may choose to use this instruction when generated other logic constructs (in this case equality checks combined with an &&). The description is certainly misleading, updating the mutator to make it more accurate would however involve writing the large part of a decompiler.

            Source https://stackoverflow.com/questions/69843291

            QUESTION

            Why is Pitest throwing a NoSuchMethodError?
            Asked 2021-Oct-05 at 18:30

            So I recently upgraded one of my repos to Java 11 and updated the versions of some of the other dependencies. After going through several of the dependencies and resolving all of the errors, I finally got the application to pass all unit and integration tests and it was running normally again. However, when I push the project it also automatically performs mutation tests through Pitest.

            This is done in a completely clean environment: a docker container is spun up with the necessary Java and Maven versions (Java 11 and Maven 3.6.3).

            The mutation tests fail to compile now, and the following stack trace is given:

            ...

            ANSWER

            Answered 2021-Oct-05 at 18:30

            Turns out our remote environment was running the tests a slightly different way and was using a plugin for pitest that was not explicitly defined in our POM. The plugin was Alex Victoor's pitest-cucumber-plugin which includes a compatibility matrix that I was able to use to resolve the issue.

            Source https://stackoverflow.com/questions/68841287

            QUESTION

            pitest report can't mix JUnit 4 and JUnit 5 tests
            Asked 2021-Oct-01 at 18:37

            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 after adding Pitest JUnit 5 plugin when we try to run the mutation testing goal mvn org.pitest:pitest-maven:mutationCoverage, and it only picks up JUnit 4 tests and ignores JUnit 5 tests.

            We want our report to contain JUnit 4 and 5 tests. Is there a way(hack) to generate a report mixed with JUnit 4 and 5?

            ...

            ANSWER

            Answered 2021-Oct-01 at 18:37

            As pointed by henry's comment, I fixed the issue by upgrading to the latest version of pitest. These versions worked for me:

            Source https://stackoverflow.com/questions/69386883

            QUESTION

            How to exclude test classes from PIT mutation test with maven command line arguments?
            Asked 2021-Sep-07 at 11:30

            I'm trying to run the mutation tests for all the unit tests, so I need to exclude the integration tests from the run.

            I've tried these commands without success:

            ...

            ANSWER

            Answered 2021-Sep-07 at 11:30

            According to the Maven plugin quickstart documentation for Pitest there's a excludedTestClasses configuration parameter where you can specify which tests should be excluded. So assuming all your integration tests are in the same package you should be able to do something like this:

            Source https://stackoverflow.com/questions/69077845

            QUESTION

            Linux pipe to text file shows unwanted special characters in text editor
            Asked 2021-Aug-02 at 22:33

            my symfony help >> ./symfonyBinConsole2copyQ.sh; looks encrypted for me.

            result looks in Kate editor like so: ...

            ANSWER

            Answered 2021-Aug-02 at 22:33

            Various console apps either default to showing with Ansi terminal codes, or without. The Symfony console command has a --no-ansi option to turn it off.

            An issue at https://github.com/symfony/cli/issues/222 also suggested the env var NO_COLOR, which does also work.

            Source https://stackoverflow.com/questions/68627916

            QUESTION

            maven + mutation test
            Asked 2021-Jul-10 at 17:11

            I followed this tutorial: https://pitest.org/quickstart/maven/

            jar file won't open. I have Java Version 8 Update 291.

            I tried:

            ...

            ANSWER

            Answered 2021-Jul-10 at 17:11

            how to actually setup mutation testing in maven

            basically... follow this tutorial: https://pitest.org/quickstart/maven/

            skip the installation part in the tutorial

            download apache-maven-3.8.1 [or whatever is the latest version]

            add the downloaded file to your path via command line:

            Source https://stackoverflow.com/questions/68328300

            QUESTION

            Is it possible to piTest a removed call to scala/MatchError::
            Asked 2021-May-14 at 13:28

            I am curious to know if it is possible to fully test following code with Pitest/ScalaCheck

            Methods to test:

            ...

            ANSWER

            Answered 2021-May-14 at 13:28

            The call to scala/MatchError is synthesized by the compiler for the case where the match fails (it's the call to MatchError's constructor which gets thrown if none of the cases in the pattern match apply). Since your pattern match is in fact exhaustive, there's no way for the match to fail, ergo there's no way in Scala to force the match to fail (this is assuming that you're using the standard library List; if you're using your own implementation of List, perhaps it's not sealed?)

            It's perhaps a Scala compiler bug that it generates bytecode for failed pattern matches which can't fail.

            I'm not familiar with pitest, but it's likely that it doesn't understand Scala (or the higher level semantic meaning of the bytecode emitted by the Scala compiler); tools which rely on bytecode manipulation are likely to not always work as they would for Java with Scala.

            Source https://stackoverflow.com/questions/67506713

            QUESTION

            PITest skips tests in ant
            Asked 2021-Feb-22 at 14:06

            I have the problem, that PITest skips some of my tests. It reports no line coverage for the tested class and all mutations in stay alive:

            replaced return value with Collections.emptyList for ... → NO_COVERAGE

            The list below is empty:

            Tests examined

            I did check the following:

            • the class file of class and test is supported in one of the directories in the classpath
            • the test is not excluded
            • tests in the same directory are run
            • source directory is provided correctly
            • no errors occur on the console, even when logging with verbose=true
            • I logged and checked all parameters
            ...

            ANSWER

            Answered 2021-Feb-22 at 14:06

            After a hell of a lot of debugging and trying things out, I found out that test methods were not found because the junit dependency hamcrest-core was missing.

            For everyone else experiencing a problem like this, try debugging the following method:

            Source https://stackoverflow.com/questions/66154859

            Community Discussions, Code Snippets contain sources that include Stack Exchange Network

            Vulnerabilities

            No vulnerabilities reported

            Install pitest

            You can download it from GitHub, Maven.
            You can use pitest like any standard Java library. Please include the the jar files in your classpath. You can also use any IDE and you can run and debug the pitest component as you would do with any other Java program. Best practice is to use a build tool that supports dependency management such as Maven or Gradle. For Maven installation, please refer maven.apache.org. For Gradle installation, please refer gradle.org .

            Support

            For any new features, suggestions and bugs create an issue on GitHub. If you have any questions check and ask questions on community page Stack Overflow .
            Find more information at:

            Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items

            Find more libraries
            Install
            Maven
            Gradle
            CLONE
          • HTTPS

            https://github.com/hcoles/pitest.git

          • CLI

            gh repo clone hcoles/pitest

          • sshUrl

            git@github.com:hcoles/pitest.git

          • Stay Updated

            Subscribe to our newsletter for trending solutions and developer bootcamps

            Agree to Sign up and Terms & Conditions

            Share this Page

            share link