Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/halleck45/mutatesting
mutation testing tool for PHP
https://github.com/halleck45/mutatesting
Last synced: about 2 months ago
JSON representation
mutation testing tool for PHP
- Host: GitHub
- URL: https://github.com/halleck45/mutatesting
- Owner: Halleck45
- License: mit
- Created: 2013-05-29T16:40:55.000Z (over 11 years ago)
- Default Branch: master
- Last Pushed: 2014-06-13T07:01:07.000Z (over 10 years ago)
- Last Synced: 2024-10-31T17:51:56.929Z (about 2 months ago)
- Language: PHP
- Size: 2.36 MB
- Stars: 65
- Watchers: 7
- Forks: 10
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# MutaTesting
Mutation testing tool for PHP.
[![Build Status](https://secure.travis-ci.org/Halleck45/MutaTesting.png)](http://travis-ci.org/Halleck45/MutaTesting)
[![Latest Stable Version](https://poser.pugx.org/halleck45/mutatesting/v/stable.png)](https://packagist.org/packages/halleck45/mutatesting)According to [Wikipedia](http://en.wikipedia.org/wiki/Mutation_testing):
> 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.MutaTesting supports [PHPUnit](http://phpunit.de/manual/current/en/index.html) and [atoum](http://docs.atoum.org/).
You can create an adapter for any PHP testing framework.## Requirements
You only need PHP 5.3 . No specific PHP extension is required...
## Installation
### As phar archive
Simply download the [phar archive](build/mutatesting.phar) and run the following command :
```
php mutatesting.phar {tool} {binary} {test directory}
```### With Composer
Edit your `composer.json`:
```json
"require": {
"halleck45/mutatesting" : "@dev"
}
```And run Composer:
```bash
php composer.phar update halleck45/mutaTesting
```## Usage
```bash
./bin/mutatesting {tool} {binary} {test directory}
```Example for PHPUnit:
```bash
./bin/mutatesting phpunit phpunit.phar myTestFolder
```Example for atoum:
```bash
./bin/mutatesting atoum mageekguy.atoum.phar myTestFolder
```Note that you don't need to use the `-d` or `-f` option with atoum...
### Advanced usage
#### Strategy
In order to avoid to have too much mutants, MutaTesting uses [PhpMetrics](https://github.com/Halleck45/PhpMetrics) in order
to estimate number of bugs in each tested file, and focuses only on files that contain more anomalies.You can use the `--bugs` option to define the limit to use.
For example, `--bugs=".6"` means that mutants are preserved only if there is at least 0.6 estimated bugs in the tested file.
#### Formatters
To have a html report file, tou need to use the `--report-html` option.
```bash
./bin/mutatesting {tool} {binary} {test directory} --report-html=/tmp/file.html
```#### Testing options
If your tests need options, you can pass them with `--options`
```bash
./bin/mutatesting phpunit phpunit.phar myTestFolder --options="-c phpunit.xml"
```#### Parallelization
You can change the number of parallelized tests with the `processes` options :
```bash
./bin/mutatesting {tool} {binary} {test directory} --processes=10
```#### Performance
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`.## Copyright
Copyright (c) 2014 Jean-François Lépine. See LICENSE for details.