MutaTesting
Mutation testing tool for PHP., (*1)
, (*2)
According to Wikipedia:, (*3)
Mutation testing (or Mutation analysis or Program mutation) evaluates the
quality of software tests. Mutation testing involves modifying a program's
source code or byte code in small ways., (*4)
MutaTesting supports PHPUnit and atoum.
You can create an adapter for any PHP testing framework., (*5)
 Requirements
You only need PHP 5.3 . No specific PHP extension is required..., (*6)
Installation
 As phar archive
Simply download the phar archive and run the following command :, (*7)
php mutatesting.phar {tool} {binary} {test directory}
With Composer
Edit your composer.json
:, (*8)
"require": {
"halleck45/mutatesting" : "@dev"
}
And run Composer:, (*9)
php composer.phar update halleck45/mutaTesting
Usage
./bin/mutatesting {tool} {binary} {test directory}
Example for PHPUnit:, (*10)
./bin/mutatesting phpunit phpunit.phar myTestFolder
Example for atoum:, (*11)
./bin/mutatesting atoum mageekguy.atoum.phar myTestFolder
Note that you don't need to use the -d
or -f
option with atoum..., (*12)
Advanced usage
Strategy
In order to avoid to have too much mutants, MutaTesting uses PhpMetrics in order
to estimate number of bugs in each tested file, and focuses only on files that contain more anomalies., (*13)
You can use the --bugs
option to define the limit to use., (*14)
For example, --bugs=".6"
means that mutants are preserved only if there is at least 0.6 estimated bugs in the tested file., (*15)
To have a html report file, tou need to use the --report-html
option., (*16)
./bin/mutatesting {tool} {binary} {test directory} --report-html=/tmp/file.html
Testing options
If your tests need options, you can pass them with --options
, (*17)
./bin/mutatesting phpunit phpunit.phar myTestFolder --options="-c phpunit.xml"
 Parallelization
You can change the number of parallelized tests with the processes
options :, (*18)
./bin/mutatesting {tool} {binary} {test directory} --processes=10
MutaTesting is very slow : your unit tests will be runned as many times as there are mutant.
In order to increase performance, a cache file is created in /tmp/muta-cache.php
., (*19)
Copyright
Copyright (c) 2014 Jean-François Lépine. See LICENSE for details., (*20)