Skip to content
SPECIFICTION
Get listed

Infection vs PIT

Infection

infection.github.io

PIT

pitest.org

Side by side

FigureInfectionPIT
Price from——
Free plan——
Free trial——
Open source——
WebYes—
Windows—Yes
macOSYesYes
LinuxYesYes
Self-hosted—Yes
Plans published00
Spec score · Mutation Testing Tools7.6 (#11)7.0 (#20)
DistributionThe recommended PHAR distribution bundles PHPUnit, PhpSpec, Codeception and Testo, and the PHAR signature can be verified with the documented GPG key.PIT releases are available through GitHub and its binaries are available on Maven Central.
PurposeInfection mutates PHP source code and reports changes that a test suite fails to catch.PIT runs unit tests against automatically modified versions of application code to measure whether tests detect faults.

In their own words

Infection

Infection is a PHP mutation-testing library that shows which changes a test suite fails to detect. It creates mutants using predefined operators, runs tests against changed code, and records killed and escaped mutants, errors, and timeouts. Its Mutation Score Indicator measures the share of generated mutations detected by tests; it also reports Mutation Code Coverage and Covered Code Mutation Score Indicator. Infection supports PHPUnit, PhpSpec, Codeception, and Testo, and runs from the command line at a project root. Teams can run mutated tests in parallel, focus analysis on touched lines or files, and set minimum mutation-score thresholds that fail a build. The homepage describes more than 100 mutators grouped into profiles and allows custom mutators. Optional PHPStan and Mago integrations can help catch escaped mutants involving type violations, dead code, and unreachable paths. Installation options include PHAR, Phive, Composer, Git, and Homebrew. A browser playground supports trying PHP code and tests without installing the tools. Infection is free under the BSD-3-Clause license and requires PHP 8.3 or newer plus Xdebug, phpdbg, or pcov.

Visit infection.github.io

PIT

PIT is a free mutation-testing tool for Java and JVM bytecode projects. It measures whether unit tests detect faults by running them against modified versions of application code. Configurable bytecode mutations can remove method calls, invert logic, or change return values. PIT selects and prioritizes tests using line coverage, execution speed, and naming conventions, then reports mutation coverage alongside line coverage. It can run from the command line, Ant, or Maven; third-party integrations are listed for Gradle, Eclipse, and IntelliJ. Java is supported directly, and Kotlin use is available through the ArcMutate plugin. PIT supports JUnit 3, JUnit 4, and TestNG; JUnit 5 needs a plugin. Versions 1.4.0 and later require Java 8 or above and JUnit or TestNG on the classpath. Mutation runs can take a long time depending on codebase size and test-suite speed, so PIT recommends focusing on changed code. It mutates bytecode and requires line numbers and source file names in that bytecode.

Visit pitest.org