PHPackages                             vtsmedia/paratest - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Testing &amp; Quality](/categories/testing)
4. /
5. vtsmedia/paratest

ActiveLibrary[Testing &amp; Quality](/categories/testing)

vtsmedia/paratest
=================

Parallel testing for PHP

1.0.2(8y ago)02.9kMITPHPPHP &gt;=5.5.11

Since Nov 2Pushed 8y ago3 watchersCompare

[ Source](https://github.com/VTSMedia/paratest)[ Packagist](https://packagist.org/packages/vtsmedia/paratest)[ Docs](https://github.com/elliotmoso/paratest)[ RSS](/packages/vtsmedia-paratest/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (1)Dependencies (6)Versions (63)Used By (0)

ParaTest
========

[](#paratest)

[![Build Status](https://camo.githubusercontent.com/446a6adff9f4b928204ed03bcf4290a09d0b22b925f7374befeab7b7023fde97/68747470733a2f2f7472617669732d63692e6f72672f627269616e69756d2f70617261746573742e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/brianium/paratest)[![HHVM Status](https://camo.githubusercontent.com/e1f425f618cee9849717400a37c2186ae85cb080b1fbed30b2bb93f71499bcf5/687474703a2f2f6868766d2e683463632e64652f62616467652f627269616e69756d2f70617261746573742e737667)](http://hhvm.h4cc.de/package/brianium/paratest)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/f432aea43759f4df7ae05f41c701d3236b64fbe66764971587c1279aab164cfe/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f627269616e69756d2f70617261746573742f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/brianium/paratest/?branch=master)[![Packagist](https://camo.githubusercontent.com/ecd15e3ef6c3a610da79d47d285250d23d9a085d2af330bf49ffbc9c89e66a00/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f627269616e69756d2f70617261746573742e737667)](https://packagist.org/packages/brianium/paratest)

The objective of ParaTest is to support parallel testing in PHPUnit. Provided you have well-written PHPUnit tests, you can drop `paratest` in your project and start using it with no additional bootstrap or configurations!

Benefits
--------

[](#benefits)

Why use `paratest` over the alternative parallel test runners out there?

- Code Coverage report combining. *Run your tests in N parallel processes and all the code coverage output will be combined into one report.*
- Zero configuration. *After composer install, run with `vendor/bin/paratest -p4 path/to/tests`. That's it!*
- Flexible. *Isolate test files in separate processes or take advantage of WrapperRunner for even faster runs.*

Installation
------------

[](#installation)

### Composer

[](#composer)

To install with composer add the following to your `composer.json` file:

```
"require": {
    "brianium/paratest": "dev-master"
}
```

Then run `php composer.phar install`

Usage
-----

[](#usage)

After installation, the binary can be found at `vendor/bin/paratest`. Usage is as follows:

```
Usage:
 paratest [-p|--processes="..."] [-f|--functional] [--no-test-tokens] [-h|--help] [--coverage-clover="..."] [--coverage-html="..."] [--coverage-php="..."] [-m|--max-batch-size="..."] [--filter="..."] [--phpunit="..."] [--runner="..."] [--bootstrap="..."] [-c|--configuration="..."] [-g|--group="..."] [--exclude-group="..."] [--stop-on-failure] [--log-junit="..."] [--colors] [--testsuite[="..."]] [--path="..."] [path]

Arguments:
 path                  The path to a directory or file containing tests. (default: current directory)

Options:
 --processes (-p)      The number of test processes to run. (default: 5)
 --functional (-f)     Run methods instead of suites in separate processes.
 --no-test-tokens      Disable TEST_TOKEN environment variables. (default: variable is set)
 --help (-h)           Display this help message.
 --coverage-clover     Generate code coverage report in Clover XML format.
 --coverage-html       Generate code coverage report in HTML format.
 --coverage-php        Serialize PHP_CodeCoverage object to file.
 --max-batch-size (-m) Max batch size (only for functional mode). (default: 0)
 --filter              Filter (only for functional mode).
 --phpunit             The PHPUnit binary to execute. (default: vendor/bin/phpunit)
 --runner              Runner or WrapperRunner. (default: Runner)
 --bootstrap           The bootstrap file to be used by PHPUnit.
 --configuration (-c)  The PHPUnit configuration file to use.
 --group (-g)          Only runs tests from the specified group(s).
 --exclude-group       Don't run tests from the specified group(s).
 --stop-on-failure     Don't start any more processes after a failure.
 --log-junit           Log test execution in JUnit XML format to file.
 --colors              Displays a colored bar as a test result.
 --testsuite           Filter which testsuite to run
 --path                An alias for the path argument.

```

### Optimizing Speed

[](#optimizing-speed)

To get the most out of paratest, you have to adjust the parameters carefully.

1. **Adjust the number of processes with `-p`**

    To allow full usage of your cpu cores, you should have at least one process per core. More processes allow better resource usage but keep in mind that each process has it's own costs for spawning.
2. **Choose between per-testcase- and per-testmethod-parallelization with `-f`**

    Given you have few testcases (classes) with many long running methods, you should use the `-f` option to enable the `functional mode` and allow different methods of the same class to be executed in parallel. Keep in mind that the default is per-testcase-parallelization to address inter-testmethod dependencies. Note that in most projects, using `-f` is **slower** since each test **method** will need to be bootstrapped separately.
3. **Use the WrapperRunner if possible**

    The default Runner for PHPUnit spawns a new process for each testcase (or method in functional mode). This provides the highest compatibility but comes with the cost of many spawned processes and a bootstrapping for each process. Especially when you have a slow bootstrapping in your tests (like a database setup) you should try the WrapperRunner with `--runner WrapperRunner`. It spawns one "worker"-process for each parallel process (`-p`), executes the bootstrapping once and reuses these processes for each test executed. That way the overhead of process spawning and bootstrapping is reduced to the minimum.
4. **Tune batch max size `--max-batch-size`**

    Batch size will affect on max amount of atomic tests which will be used for single test method. One atomic test will be either one test method from test class if no data provider available for method or will be only one item from dataset for method. Increase this value to reduce per-process overhead and in most cases it will also reduce parallel efficiency. Decrease this value to increase per-process overhead and in most cases it will also increase parallel efficiency. If amount of all tests less then max batch size then everything will be processed in one process thread so paratest is completely useless in that case. The best way to find the most effective batch size is to test with different batch size values and select best. Max batch size = 0 means that grouping in batches will not be used and one batch will equal to all method tests (one or all from data provider). Max batch size = 1 means that each batch will contain only one test from data provider or one method if data provider is not used. Bigger max batch size can significantly increase phpunit command line length so process can failed. Decrease max batch size to reduce command line length. Windows has limit around 32k, Linux - 2048k, Mac OS X - 256k.

### Examples

[](#examples)

Examples assume your tests are located under `./test/unit`.

```
# Run all unit tests in 8 parallel processes
vendor/bin/paratest -p8 test/unit

```

```
# Run all unit tests in 4 parallel processes with WrapperRunner and output html code coverage report to /tmp/coverage
# (Code coverage requires Xdebug to be installed)
vendor/bin/paratest -p8 --runner=WrapperRunner --coverage-html=/tmp/coverage test/unit

```

### Windows

[](#windows)

Windows users be sure to use the appropriate batch files.

An example being:

`vendor\bin\paratest.bat --phpunit vendor\bin\phpunit.bat ...`

ParaTest assumes [PSR-0](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-0.md) for loading tests.

For convenience paratest windows version use 79 columns mode to prevent blank lines in standard 80x25 windows console.

PHPUnit Xml Config Support
--------------------------

[](#phpunit-xml-config-support)

When running PHPUnit tests, ParaTest will automatically pass the phpunit.xml or phpunit.xml.dist to the phpunit runner via the --configuration switch. ParaTest also allows the configuration path to be specified manually.

ParaTest will rely on the `testsuites` node of phpunit's xml configuration to handle loading of suites.

The following phpunit config file is used for ParaTest's test cases.

```

            ./tests/

```

Test token
----------

[](#test-token)

The `TEST_TOKEN` environment variable is guaranteed to have a value that is different from every other currently running test. This is useful to e.g. use a different database for each test:

```
if (getenv('TEST_TOKEN') !== false) {  // Using partest
    $dbname = 'testdb_' . getenv('TEST_TOKEN');
} else {
    $dbname = 'testdb';
}
```

For Contributors: Testing paratest itself
-----------------------------------------

[](#for-contributors-testing-paratest-itself)

ParaTest's test suite depends on PHPUnit being installed via composer. Make sure you run `composer install` after cloning.

**Note that The `display_errors` php.ini directive must be set to `stderr` to run the test suite.**

To run unit tests: `vendor/bin/phpunit test/unit`

To run functional tests: `vendor/bin/phpunit test/functional`

You can run all tests at once by running phpunit from the project directory. `vendor/bin/phpunit`

ParaTest can run its own test suite by running it from the `bin` directory. `bin/paratest`

For an example of ParaTest out in the wild check out the [example](https://github.com/brianium/paratest-selenium).

###  Health Score

35

—

LowBetter than 79% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity16

Limited adoption so far

Community21

Small or concentrated contributor base

Maturity72

Established project with proven stability

 Bus Factor2

2 contributors hold 50%+ of commits

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~36 days

Recently: every ~17 days

Total

49

Last Release

3179d ago

Major Versions

0.15.0 → 1.0.02017-06-16

PHP version history (4 changes)v0.1.0PHP &gt;=5.3.0

0.13.0PHP &gt;=5.4.0

0.14.0PHP &gt;=5.5.11

1.0.0PHP &gt;=7.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/30cc051d39500e767dfae7d907fb4eed3bcef07f489e2ae2849db13758d8056c?d=identicon)[VtsMedia](/maintainers/VtsMedia)

---

Top Contributors

[![brianium](https://avatars.githubusercontent.com/u/636651?v=4)](https://github.com/brianium "brianium (232 commits)")[![julianseeger](https://avatars.githubusercontent.com/u/3258762?v=4)](https://github.com/julianseeger "julianseeger (131 commits)")[![giorgiosironi](https://avatars.githubusercontent.com/u/160299?v=4)](https://github.com/giorgiosironi "giorgiosironi (65 commits)")[![chbiel](https://avatars.githubusercontent.com/u/1297702?v=4)](https://github.com/chbiel "chbiel (21 commits)")[![michaelbutler](https://avatars.githubusercontent.com/u/521702?v=4)](https://github.com/michaelbutler "michaelbutler (15 commits)")[![ebi](https://avatars.githubusercontent.com/u/11541?v=4)](https://github.com/ebi "ebi (15 commits)")[![dbaltas](https://avatars.githubusercontent.com/u/442804?v=4)](https://github.com/dbaltas "dbaltas (14 commits)")[![lox](https://avatars.githubusercontent.com/u/15758?v=4)](https://github.com/lox "lox (9 commits)")[![sormy](https://avatars.githubusercontent.com/u/7675583?v=4)](https://github.com/sormy "sormy (7 commits)")[![Cameronjmayfield](https://avatars.githubusercontent.com/u/1444395?v=4)](https://github.com/Cameronjmayfield "Cameronjmayfield (4 commits)")[![localheinz](https://avatars.githubusercontent.com/u/605483?v=4)](https://github.com/localheinz "localheinz (4 commits)")[![oker1](https://avatars.githubusercontent.com/u/431237?v=4)](https://github.com/oker1 "oker1 (3 commits)")[![munkie](https://avatars.githubusercontent.com/u/102297?v=4)](https://github.com/munkie "munkie (3 commits)")[![MarkVaughn](https://avatars.githubusercontent.com/u/39970?v=4)](https://github.com/MarkVaughn "MarkVaughn (3 commits)")[![mmenozzi](https://avatars.githubusercontent.com/u/1199914?v=4)](https://github.com/mmenozzi "mmenozzi (3 commits)")[![ChubV](https://avatars.githubusercontent.com/u/2264412?v=4)](https://github.com/ChubV "ChubV (3 commits)")[![tdelteil](https://avatars.githubusercontent.com/u/16309708?v=4)](https://github.com/tdelteil "tdelteil (2 commits)")[![dimarick](https://avatars.githubusercontent.com/u/2605934?v=4)](https://github.com/dimarick "dimarick (2 commits)")[![drscre](https://avatars.githubusercontent.com/u/844519?v=4)](https://github.com/drscre "drscre (2 commits)")[![jwoschitz](https://avatars.githubusercontent.com/u/856556?v=4)](https://github.com/jwoschitz "jwoschitz (2 commits)")

---

Tags

testingphpunitconcurrentparallel

### Embed Badge

![Health badge](/badges/vtsmedia-paratest/health.svg)

```
[![Health](https://phpackages.com/badges/vtsmedia-paratest/health.svg)](https://phpackages.com/packages/vtsmedia-paratest)
```

###  Alternatives

[brianium/paratest

Parallel testing for PHP

2.5k118.8M753](/packages/brianium-paratest)[orchestra/testbench

Laravel Testing Helper for Packages Development

2.2k39.1M32.0k](/packages/orchestra-testbench)[infection/infection

Infection is a Mutation Testing framework for PHP. The mutation adequacy score can be used to measure the effectiveness of a test set in terms of its ability to detect faults.

2.2k26.2M1.8k](/packages/infection-infection)[phpbench/phpbench

PHP Benchmarking Framework

2.0k13.0M627](/packages/phpbench-phpbench)[magento/magento2-functional-testing-framework

Magento2 Functional Testing Framework

15511.5M30](/packages/magento-magento2-functional-testing-framework)[facile-it/paraunit

paraunit

146721.6k11](/packages/facile-it-paraunit)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
