:computer: Parallel testing for PHPUnit

Related tags

Testing paratest
Overview

ParaTest

Latest Stable Version Downloads Integrate Code Coverage Type Coverage Infection MSI

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

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. That's it!
  • Flexible. Isolate test files in separate processes or take advantage of WrapperRunner for even faster runs.

Installation

To install with composer run the following command:

composer require --dev brianium/paratest

Versions

Only the latest version of PHPUnit is supported, and thus only the latest version of ParaTest is actively maintained.

This is because of the following reasons:

  1. To reduce bugs, code duplication and incompatibilities with PHPUnit, from version 5 ParaTest heavily relies on PHPUnit @internal classes
  2. The fast pace both PHP and PHPUnit have taken recently adds too much maintenance burden, which we can only afford for the latest versions to stay up-to-date

Usage

After installation, the binary can be found at vendor/bin/paratest. Run it with --help option to see a complete list of the available options.

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 its own costs for spawning. The default is auto, which means the number of logical CPU cores is set as number of processes. You might try something like logical CPU cores * 2 (e.g. if you have 8 logical cores, you might try 16), but keep in mind that each process generates a little bit of overhead as well.

  2. 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.

  3. 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.

  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 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 -p4 --runner=WrapperRunner --coverage-html=/tmp/coverage test/unit

Troubleshooting

If you run into problems with paratest, try to get more information about the issue by enabling debug output via --verbose=1.

When a sub-process fails, the originating command is given in the output and can then be copy-pasted in the terminal to be run and debugged. All internal commands run with --printer [...]\NullPhpunitPrinter which silence the original PHPUnit output: during a debugging run remove that option to restore the output and see what PHPUnit is doing.

Generating code coverage

Beginning from PHPUnit 9.3.4, it is strongly advised to set a coverage cache directory, see PHPUnit Changelog @ 9.3.4.

The cache is always warmed by ParaTest before executing the test suite.

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

vendor/bin/paratest --coverage-text test/unit

Running phpunit in 1 process with /codebase/paratest/vendor/phpunit/phpunit/phpunit

Configuration read from /codebase/paratest/phpunit.xml.dist

...............................................................  63 / 155 ( 40%)
............................................................... 126 / 157 ( 80%)
.....................................

Time: 27.2 seconds, Memory: 8.00MB

OK (163 tests, 328 assertions)


Code Coverage Report:
  2019-01-25 09:41:26

 Summary:
  Classes: 22.86% (8/35)
  Methods: 49.47% (139/281)
  Lines:   59.38% (896/1509)

Caution: Generating coverage is an art in itself. Please refer to our extensive guide on setting up everything correctly for code coverage generation with paratest.

Windows

Windows users be sure to use the appropriate batch files.

An example being:

vendor\bin\paratest.bat ...

ParaTest assumes PSR-0 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

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.

<?xml version="1.0" encoding="UTF-8"?>
<phpunit>
    <testsuites>
        <testsuite name="ParaTest Fixtures">
            <directory>./tests/</directory>
        </testsuite>
    </testsuites>
</phpunit>

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 paratest
    $dbname = 'testdb_' . getenv('TEST_TOKEN');
} else {
    $dbname = 'testdb';
}

Caveats

  1. Constants, static methods, static variables and everything exposed by test classes consumed by other test classes (including Reflection) are not supported. This is due to a limitation of the current implementation of WrapperRunner and how PHPUnit searches for classes. The fix is put shared code into classes which are not tests themselves.

For Contributors: Testing paratest itself

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

Before creating a Pull Request be sure to run all the necessary checks with make command.

For an example of ParaTest out in the wild check out the example.

Comments
  • No info on failing / risky tests

    No info on failing / risky tests

    PHPunit now distincts between errors and failures. When we have failures the suite exits with status != 0 as expected but we dont get any clue on the problem.

     ./vendor/bin/paratest                              
    
    Running phpunit in 5 processes with /home/jean/projects/compufacil/Backend/vendor/bin/phpunit
    
    Configuration read from /home/jean/projects/compufacil/Backend/phpunit.xml.dist
    
    .........................................S.............SS....   61 / 1534 (  3%)
    .....S............SSS.........................S..............  122 / 1534 (  7%)
    ........................................SSSSSSSSS............  183 / 1534 ( 11%)
    ..........S..................................................  244 / 1534 ( 15%)
    .............................................SSSSSS..........  305 / 1544 ( 19%)
    .............................................................  366 / 1545 ( 23%)
    .............................................................  427 / 1545 ( 27%)
    ...............SS............................................  488 / 1545 ( 31%)
    .............................................SSS.........S...  549 / 1545 ( 35%)
    .............................................................  610 / 1545 ( 39%)
    .............................................................  671 / 1547 ( 43%)
    .............................................................  732 / 1547 ( 47%)
    ..........................S......S...........................  793 / 1554 ( 51%)
    .........S..............=.....................................  854 / 1556 ( 54%)
    .............................................................  915 / 1556 ( 58%)
    ......SSS.........S..........SSSSSSSSSS......................  976 / 1556 ( 62%)
    ............................................................. 1037 / 1557 ( 66%)
    ......S...................................................... 1098 / 1562 ( 70%)
    ............................................................. 1159 / 1576 ( 73%)
    ............................................................. 1220 / 1613 ( 75%)
    ............................................................. 1281 / 1616 ( 79%)
    ............................................................. 1342 / 1621 ( 82%)
    ............................................................. 1403 / 1621 ( 86%)
    .....S..............................SSSSS.................... 1464 / 1621 ( 90%)
    ...........................S.........SSSSSSSSS............... 1525 / 1621 ( 94%)
    ..............................................S.............. 1586 / 1623 ( 97%)
    .................S...................
    
    Time: 1.08 minutes, Memory: 48.00MB
    
    
    FAILURES!
    Tests: 1623, Assertions: 3900, Failures: 1, Errors: 0.
    
    enhancement priority 
    opened by jeanCarloMachado 30
  • Reuse bootstrap: --runner WrapperRunner

    Reuse bootstrap: --runner WrapperRunner

    Related to https://github.com/brianium/paratest/issues/26 Results are the same with the old runner (Runner) and new one (WrapperRunner) afaik. Workers that crash trigger an exception in the main process. I plan to do more work on this (extracting a WorkerPool object, restarting workers and signaling crashed tests as errors, investigating performance), but this is the minimum marketable feature.

    opened by giorgiosironi 29
  • Native implementation?

    Native implementation?

    ParaTest has definitely solved some issues for me - particularly in the functional testing realm, and I am glad to see it has done the same for a bunch of other people.

    I think it is becoming too cumbersome to rely on PHPUnit as a hard dependency. The benefit of this approach is you can run existing PHPUnit suites concurrently, but PHPUnit can introduce a breaking change - and I don't think it is worth the investment to have ParaTest fully support all PHPUnit configuration options.

    I have been drawing up some ideas for a new test framework that has concurrency baked in.

    Any thoughts on converting ParaTest to a [READONLY] and beginning work on a new framework altogether (particularly one that can take advantage of php 5.5 coroutines and generators?)

    question 
    opened by brianium 28
  • @dataProvider tests parallelization in functional mode

    @dataProvider tests parallelization in functional mode

    • @dataProvider support
    • --filter support (functional mode only)
    • --max-batch-size support (functional mode only)
    • print progress as vanilla phpunit
    • print progress without blank lines on windows default console
    • dump process command line for debug purposes if process do not return any results
    • one failed vanilla test: PHPUnitTest::testStopOnFailurePreventsStartingFurtherTestsAfterFailure
    • no auto tests for new features for now
    enhancement 
    opened by sormy 25
  • "Coverage file /tmp/CV_L8DgkT is empty. This means a PHPUnit process has crashed." when running with "--coverage-clover"

    | Q | A | --- | --- | ParaTest version | 6.2.0 | PHPUnit version | 9.5.2 | PHP version | 7.4

    Summary

    "Coverage file /tmp/CV_L8DgkT is empty. This means a PHPUnit process has crashed." when running with "--coverage-clover" on every CircleCI, AWS CodeBuild & Docker builds (works fine locally on mac)

    Previously posted #397 - But looks like it was closed without a solution

    Current behavior

    1st test in the suite passes, second immediately fails with the previously mentioned error.

    How to reproduce: command, code and error stack trace

    Command being run: ./vendor/bin/paratest -p 8 --coverage-clover deployment/coverage.xml --verbose

    Stacktrace of the error with the --verbose flag added:

    In CoverageMerger.php line 59:
                                                                                   
      [ParaTest\Coverage\EmptyCoverageFileException]                               
      Coverage file /tmp/CV_L8DgkT is empty. This means a PHPUnit process has cra  
      shed.                                                                        
                                                                                   
    
    Exception trace:
      at /root/project/vendor/brianium/paratest/src/Coverage/CoverageMerger.php:59
     ParaTest\Coverage\CoverageMerger->addCoverageFromFile() at /root/project/vendor/brianium/paratest/src/Runners/PHPUnit/Runner.php:118
     ParaTest\Runners\PHPUnit\Runner->testIsStillRunning() at /root/project/vendor/brianium/paratest/src/Runners/PHPUnit/Runner.php:43
     ParaTest\Runners\PHPUnit\Runner->doRun() at /root/project/vendor/brianium/paratest/src/Runners/PHPUnit/BaseRunner.php:81
     ParaTest\Runners\PHPUnit\BaseRunner->run() at /root/project/vendor/brianium/paratest/src/Console/Commands/ParaTestCommand.php:84
     ParaTest\Console\Commands\ParaTestCommand->execute() at /root/project/vendor/symfony/console/Command/Command.php:256
     Symfony\Component\Console\Command\Command->run() at /root/project/vendor/symfony/console/Application.php:971
     Symfony\Component\Console\Application->doRunCommand() at /root/project/vendor/symfony/console/Application.php:290
     Symfony\Component\Console\Application->doRun() at /root/project/vendor/symfony/console/Application.php:166
     Symfony\Component\Console\Application->run() at /root/project/vendor/brianium/paratest/bin/paratest:37
    

    Expected behavior

    Test suite runs as expected and a code coverage report is compiled.

    Additional information

    Looking through the code, won't this always happen?

    TheCoverageMerger::addCoverageFromFile function fails over on these conditions: ! is_file($coverageFile) || filesize($coverageFile) === 0

    Which is previously calling ExecutableTest::touchTempFile which will always be 0 size until data is added in (this is under the assumption that it is in fact a file, it just fails over on the size).

    Apologies if the "Additional Information" is just my lack of understanding with the process.

    bug Stale 
    opened by MajorasJack 23
  • Occasional

    Occasional "This worker has crashed." errors

    Hey, guys! 🙂

    I run my tests on the Codeship CI using ParaTest like this:

    ./vendor/bin/paratest --colors --runner WrapperRunner --exclude-group network

    Everything works fine 49/50 of the times.

    But, from time to time, occasionally I have this error (for different, random tests):

    ...........................
    In BaseWorker.php line 97:
    
    This worker has crashed.
    Output:
    ----------------------                                                       
    Worker starting                                                              
    Executing: '/home/rof/src/github.com/foo/bar/ve  
    ndor/phpunit/phpunit/phpunit' '--exclude-group' 'network' '--configuration'  
    '/home/rof/src/github.com/foo/bar/phpunit.xml'  
    '--log-junit' '/tmp/PT_gvNGF0' 'Tests\Feature\Http\Controllers\Company\Com  
    panyMemberControllerTest'
    '/home/rof/src/github.com/foo/bar/tests/Feature/Http/Controllers/Company/
    CompanyMemberControllerTest.php'
    
    ----------------------                                                       
    Bus error (core dumped)                                                      
    
    
    paratest [-p|--processes PROCESSES] [-f|--functional] [--no-test-tokens] [-h|--help] [--coverage-clover COVERAGE-CLOVER] [--coverage-html COVERAGE-HTML] [--coverage-php COVERAGE-PHP] [--coverage-text] [--coverage-xml COVERAGE-XML] [-m|--max-batch-size MAX-BATCH-SIZE] [--filter FILTER] [--parallel-suite] [--passthru PASSTHRU] [--passthru-php PASSTHRU-PHP] [-v|--verbose VERBOSE] [--whitelist WHITELIST] [--phpunit PHPUNIT] [--runner RUNNER] [--bootstrap BOOTSTRAP] [-c|--configuration CONFIGURATION] [-g|--group GROUP] [--exclude-group EXCLUDE-GROUP] [--stop-on-failure] [--log-junit LOG-JUNIT] [--colors] [--testsuite [TESTSUITE]] [--path PATH] [--] [<path>]
    
    Script ./vendor/bin/paratest --colors --runner WrapperRunner --exclude-group network handling the test:ci event returned with error code 1
    

    If I just restart the build (after the error) - it works fine, so these are just some kind of random failures.

    So, my questions are:

    1. Does this relate to the usage of the --runner WrapperRunner? If I remove it from the command, may it help?
    2. On the Codeship, I have 32-64 available CPU cores, so there are a lot of parallel processes. May it be related to that big amount of the processes?
    3. Do you have any other suggestions on how can I avoid this error for sure?

    Thank you!

    Stale 
    opened by dmitry-ivanov 23
  • Log file /tmp/PT_fBkCmo is empty. This means a PHPUnit process has crashed.

    Log file /tmp/PT_fBkCmo is empty. This means a PHPUnit process has crashed.

    Hello, I have a problem.

    ~/.composer/vendor/bin/paratest --verbose=1 -c `pwd`/phpunit.xml --phpunit `pwd`/vendor/bin/phpunit -p 1
    
    Running phpunit in 1 process with /var/www/app/vendor/bin/phpunit
    
    Configuration read from /var/www/app/phpunit.xml
    
    
    Executing test via: /usr/local/bin/php Array Array
    An error for 1: Log file /tmp/PT_fBkCmo is empty. This means a PHPUnit process has crashed.
    The process: /usr/local/bin/php Array Array
    This means a PHPUnit process was unable to run "/var/www/app/src/Core/Tests/CoreTest.php"
    
    Command: /usr/local/bin/php Array Array
    StdErr:
    StdOut: Could not open input file: Array
    
    ~/.composer/vendor/bin/paratest --version
    ParaTest 2.2.0
    
    vendor/bin/phpunit --version
    PHPUnit 7.5.13-2-g1477fe424 by Sebastian Bergmann and contributors.
    
    php --version
    PHP 7.1.27 (cli) (built: Mar  9 2019 03:49:52) ( NTS )
    Copyright (c) 1997-2018 The PHP Group
    Zend Engine v3.1.0, Copyright (c) 1998-2018 Zend Technologies
        with Xdebug v2.7.0, Copyright (c) 2002-2019, by Derick Rethans
    
    awaiting-author-update 
    opened by lartie 20
  • Using @group throws exception

    Using @group throws exception

    Whenever we use the @group annotation we encounter the following exception

    [RuntimeException]                                                                                                                      
      Log file /tmp/PT_YQNOiy is empty.                                                                                                       
                      This means a PHPUnit process was unable to run /src/test/Components/CompetitionFilter/FilterTest.php  
                      Maybe there is more than one class in this file.
    

    Having traced the code in ParaTest we've found where the exception is being thrown and that the Reader->hasResults() method is returning false, thus causing the exception.

    However, should this code even be being executed as the test in the Exception does not contain the requested @group annotation?

    With the following lines commented out - the tests work as expected, but there could be underlying issues to which we're not aware.

    
           if (!$reader->hasResults()) {
                throw new \RuntimeException("Log file " . $test->getTempFile() . " is empty.
                    This means a PHPUnit process was unable to run " . $test->getPath() . "
                    Maybe there is more than one class in this file.");
            }
            $this->results->addReader($reader);
    

    Any advice would be appreciated.

    bug unconfirmed 
    opened by jameshd 20
  • Percentage going over 100.

    Percentage going over 100.

    Small issue I've noticed in the output for paratests : the percentage is often over 100. Exemple:

    $ $(pwd)/vendor/bin/paratest -c $(pwd)/app/phpunit.xml.dist $(pwd)/src/
    Running phpunit in 5 processes with /home/travis/build/project/vendor/bin/phpunit
    Configuration read from /home/travis/build/project/app/phpunit.xml.dist
    ...............................................................  63 / 159 ( 39%)
    ............................................................... 126 / 159 ( 79%)
    ............................................................... 189 / 159 (118%)
    ......................
    Time: 53 seconds, Memory: 12.75Mb
    OK (211 tests, 1091 assertions)
    

    As you can see here, the percentage shown is 118%. Any idea how this can happen? Could it be because of skipped / incomplete / @depend tests ?

    bug 
    opened by gnutix 20
  • [wip] Fix tests error after phpunit/phpcov new release

    [wip] Fix tests error after phpunit/phpcov new release

    composer show

    brianium/habitat                       v1.0.0
    brianium/paratest                      dev-fix-tests
    classpreloader/classpreloader          3.0.0
    composer/semver                        1.4.1
    dnoegel/php-xdg-base-dir               0.1
    doctrine/inflector                     v1.1.0
    doctrine/instantiator                  1.0.5
    folha/illuminate                       1.0.0-rc4
    folha/validation                       1.0.0-rc6
    hamcrest/hamcrest-php                  v1.2.2
    jakub-onderka/php-console-color        0.1
    jakub-onderka/php-console-highlighter  v0.3.2
    jeremeamia/SuperClosure                2.2.0
    laravel/framework                      v5.2.35
    laravelcollective/html                 v5.2.4
    league/flysystem                       1.0.24
    mockery/mockery                        0.9.5
    monolog/monolog                        1.19.0
    mtdowling/cron-expression              v1.1.0
    myclabs/deep-copy                      1.5.1
    nesbot/carbon                          1.21.0
    nikic/php-parser                       v2.1.0
    paragonie/random_compat                v1.4.1
    pdepend/pdepend                        2.2.4
    phpdocumentor/reflection-docblock      2.0.4
    phploc/phploc                          3.0.1
    phpmd/phpmd                            2.4.3
    phpspec/php-diff                       v1.0.2
    phpspec/phpspec                        2.5.0
    phpspec/prophecy                       v1.6.0
    phpunit/php-code-coverage              4.0.0
    phpunit/php-file-iterator              1.4.1
    phpunit/php-text-template              1.2.1
    phpunit/php-timer                      1.0.8
    phpunit/php-token-stream               1.4.8
    phpunit/phpcov                         3.1.0
    phpunit/phpunit                        5.4.2
    phpunit/phpunit-mock-objects           3.2.0
    psr/log                                1.0.0
    psy/psysh                              v0.7.2
    respect/validation                     1.1.2
    sebastian/code-unit-reverse-lookup     1.0.0
    sebastian/comparator                   1.2.0
    sebastian/diff                         1.4.1
    sebastian/environment                  1.3.7
    sebastian/exporter                     1.2.1
    sebastian/finder-facade                1.2.1
    sebastian/git                          2.1.2
    sebastian/global-state                 1.1.1
    sebastian/object-enumerator            1.0.0
    sebastian/phpcpd                       2.0.4
    sebastian/recursion-context            1.0.2
    sebastian/resource-operations          1.0.0
    sebastian/version                      2.0.0
    squizlabs/php_codesniffer              2.6.1
    swiftmailer/swiftmailer                v5.4.2
    symfony/config                         v3.1.0
    symfony/console                        v3.0.6
    symfony/debug                          v3.0.6
    symfony/dependency-injection           v3.1.0
    symfony/event-dispatcher               v3.1.0
    symfony/filesystem                     v3.1.0
    symfony/finder                         v3.0.6
    symfony/http-foundation                v3.0.6
    symfony/http-kernel                    v3.0.6
    symfony/polyfill-mbstring              v1.2.0
    symfony/polyfill-php56                 v1.2.0
    symfony/polyfill-util                  v1.2.0
    symfony/process                        v3.0.6
    symfony/routing                        v3.0.6
    symfony/translation                    v3.0.6
    symfony/var-dumper                     v3.0.6
    symfony/yaml                           v3.1.0
    theseer/fdomdocument                   1.6.1
    vlucas/phpdotenv                       v2.2.1
    
    opened by webysther 18
  • Coverage collection broken in 0.7.0 release

    Coverage collection broken in 0.7.0 release

    Something changed drastically related to test coverage collection from parallelly executing tests in the 0.7.0 compared to 0.6.1 versions.

    See the comparison: https://gist.github.com/aik099/11260287

    I don't know what exactly was changed, but that resulted in 50% coverage loss without actual code change.

    Travis builds:

    • when paratest 0.7.0 + phpunit 4 used: https://travis-ci.org/aik099/qa-tools/jobs/23223302
    • when paratest 0.6.1 + phpunit 3 used: https://travis-ci.org/aik099/qa-tools/jobs/23688570
    dependency-bug 
    opened by aik099 18
  • composer(deps-dev): update doctrine/coding-standard requirement from ^10.0.0 to ^10.0.0 || ^11.0.0

    composer(deps-dev): update doctrine/coding-standard requirement from ^10.0.0 to ^10.0.0 || ^11.0.0

    Updates the requirements on doctrine/coding-standard to permit the latest version.

    Release notes

    Sourced from doctrine/coding-standard's releases.

    11.0.0

    Release Notes for 11.0.0

    Backwards incompatible release (major)

    11.0.0

    BC break,CI,New rule

    BC break,Improvement

    BC break,Improvement,New rule

    Commits
    • b6660e1 Merge pull request #304 from derrabus/improvement/allow-string-interpolation
    • c140fc0 String interpolation: don't suggest sprintf()
    • 8c3c932 Merge pull request #303 from greg0ire/11.0.x
    • 3790b91 Merge remote-tracking branch 'origin/10.1.x' into 11.0.x
    • 21c24ed Merge pull request #302 from doctrine/10.0.x
    • 91106f7 Merge pull request #300 from greg0ire/adjust-expectations
    • 39c6b23 Merge pull request #290 from GaryJones/patch-1
    • 4e45530 Adjust expectations
    • f44190b Merge pull request #297 from doctrine/10.0.x
    • 05c815d Merge pull request #298 from simPod/attributes
    • Additional commits viewable in compare view

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    dependency-update 
    opened by dependabot[bot] 1
  • Warnings result in a non-0 exit code

    Warnings result in a non-0 exit code

    | Q | A | --- | --- | ParaTest version | 6.2.0 | PHPUnit version | 9.5.2 | PHP version | 7.4

    Summary

    We use warnings to mark tests that have been re-run. This sounds like a logical thing to do, especially considering the way PHPUnit itself treats them. Unfortunately, there's an inconsistency: paratest treats them as failures, even if PHPUnit process returned a successful exit code.

    Proposed solution is to rely on PHPUnit's process exit codes instead of deciding the exit code on your own. Just pass through the exit code from the runner.

    Current behavior

    Warnings result in a non-successful exit code.

    How to reproduce: command, code and error stack trace

    1. throw a warning in a test: throw new \PHPUnit\Framework\Warning();
    2. execute it with paratest

    Expected behavior

    Warnings result in a successful (0) exit code, unless otherwise specified with --fail-on-warning in passthru options.

    bug easy-pick backlog 
    opened by oprypkhantc 2
Releases(v6.8.0)
  • v6.8.0(Dec 29, 2022)

    What's Changed

    • github-actions(deps): bump actions/stale from 6 to 7 by @dependabot in https://github.com/paratestphp/paratest/pull/715
    • WrapperRunner: add --max-batch-size support by @CheapHasz in https://github.com/paratestphp/paratest/pull/714

    New Contributors

    • @CheapHasz made their first contribution in https://github.com/paratestphp/paratest/pull/714

    Full Changelog: https://github.com/paratestphp/paratest/compare/v6.7.0...v6.8.0

    Source code(tar.gz)
    Source code(zip)
  • v6.7.0(Dec 12, 2022)

    What's Changed

    • Update to PSalm 5 by @Slamdunk in https://github.com/paratestphp/paratest/pull/705
    • Support PHP 8.2 by @Slamdunk in https://github.com/paratestphp/paratest/pull/708
    • Integrate FidryCpuCoreCounter by @theofidry in https://github.com/paratestphp/paratest/pull/703

    Full Changelog: https://github.com/paratestphp/paratest/compare/v6.6.5...v6.7.0

    Source code(tar.gz)
    Source code(zip)
  • v6.6.5(Oct 28, 2022)

    What's Changed

    • github-actions(deps): bump actions/stale from 5 to 6 by @dependabot in https://github.com/paratestphp/paratest/pull/698
    • Fixes for phpstormhelper to do with re-running failed tests by @billypoke in https://github.com/paratestphp/paratest/pull/692

    Full Changelog: https://github.com/paratestphp/paratest/compare/v6.6.4...v6.6.5

    Source code(tar.gz)
    Source code(zip)
  • v6.6.4(Sep 13, 2022)

    What's Changed

    • Upgrade to doctrine/coding-standards:v10 by @Slamdunk in https://github.com/paratestphp/paratest/pull/691
    • PhpstormHelper: do no rely on external packages that are still not loaded by @Slamdunk in https://github.com/paratestphp/paratest/pull/694

    Full Changelog: https://github.com/paratestphp/paratest/compare/v6.6.3...v6.6.4

    Source code(tar.gz)
    Source code(zip)
  • v6.6.3(Aug 25, 2022)

    What's Changed

    • PhpStorm integration: consider phpunit binary located in bin directory by @alexndlm in https://github.com/paratestphp/paratest/pull/689

    New Contributors

    • @alexndlm made their first contribution in https://github.com/paratestphp/paratest/pull/689

    Full Changelog: https://github.com/paratestphp/paratest/compare/v6.6.2...v6.6.3

    Source code(tar.gz)
    Source code(zip)
  • v6.6.2(Aug 22, 2022)

    What's Changed

    • Fix typos by @krsriq in https://github.com/paratestphp/paratest/pull/688
    • Allows phpstormhelper to handle and account for coverage options by @billypoke in https://github.com/paratestphp/paratest/pull/686

    New Contributors

    • @krsriq made their first contribution in https://github.com/paratestphp/paratest/pull/688
    • @billypoke made their first contribution in https://github.com/paratestphp/paratest/pull/686

    Full Changelog: https://github.com/paratestphp/paratest/compare/v6.6.1...v6.6.2

    Source code(tar.gz)
    Source code(zip)
  • v6.6.1(Jul 22, 2022)

    What's Changed

    • Risky tests should not be counted within Errors by @Slamdunk in https://github.com/paratestphp/paratest/pull/684

    Full Changelog: https://github.com/paratestphp/paratest/compare/v6.6.0...v6.6.1

    Source code(tar.gz)
    Source code(zip)
  • v6.6.0(Jul 12, 2022)

    What's Changed

    • Make fixtures regenerable, do not flatten JUnit logs on merge by @Slamdunk in https://github.com/paratestphp/paratest/pull/678
    • Add TestDox support, fix --verbose option type, add --debug option by @Slamdunk in https://github.com/paratestphp/paratest/pull/679
    • Make --colors flag consistent with PHPUnit's one by @Slamdunk in https://github.com/paratestphp/paratest/pull/680
    • Require --random-order-seed and --repeat values by @Slamdunk in https://github.com/paratestphp/paratest/pull/681

    Full Changelog: https://github.com/paratestphp/paratest/compare/v6.5.1...v6.6.0

    Source code(tar.gz)
    Source code(zip)
  • v6.5.1(Jun 24, 2022)

    What's Changed

    • Remove unused PHPStan files by @Slamdunk in https://github.com/paratestphp/paratest/pull/675
    • Fix export of bins by @Jean85 in https://github.com/paratestphp/paratest/pull/677

    Full Changelog: https://github.com/paratestphp/paratest/compare/v6.5.0...v6.5.1

    Source code(tar.gz)
    Source code(zip)
  • v6.5.0(Jun 24, 2022)

    What's Changed

    • Document initial setup for all tests by @spawnia in https://github.com/paratestphp/paratest/pull/657
    • Escape Symfony Console output by @simPod in https://github.com/paratestphp/paratest/pull/650
    • chore: fix phpunit documentation links by @qkdreyer in https://github.com/paratestphp/paratest/pull/662
    • CS: disable mysterious Squiz.Functions.FunctionDeclaration.Found issue by @Slamdunk in https://github.com/paratestphp/paratest/pull/666
    • Fix PHP 8.2 deprecation by @shyim in https://github.com/paratestphp/paratest/pull/664
    • Add workflow for stale issues by @Jean85 in https://github.com/paratestphp/paratest/pull/667
    • Add version information by @Jean85 in https://github.com/paratestphp/paratest/pull/668
    • Fix stale action by @Jean85 in https://github.com/paratestphp/paratest/pull/669
    • Enable ParaTest on itself by @Slamdunk in https://github.com/paratestphp/paratest/pull/671
    • Add PHPStorm integration by @Slamdunk in https://github.com/paratestphp/paratest/pull/672
    • UI feedback: get closer to PHPUnit's one by @Slamdunk in https://github.com/paratestphp/paratest/pull/673
    • Update documentation by @Slamdunk in https://github.com/paratestphp/paratest/pull/674

    New Contributors

    • @spawnia made their first contribution in https://github.com/paratestphp/paratest/pull/657
    • @simPod made their first contribution in https://github.com/paratestphp/paratest/pull/650
    • @qkdreyer made their first contribution in https://github.com/paratestphp/paratest/pull/662
    • @shyim made their first contribution in https://github.com/paratestphp/paratest/pull/664
    • @Jean85 made their first contribution in https://github.com/paratestphp/paratest/pull/667

    Full Changelog: https://github.com/paratestphp/paratest/compare/v6.4.4...v6.5.0

    Source code(tar.gz)
    Source code(zip)
  • v6.4.4(Mar 28, 2022)

    What's Changed

    • Fix detection of logical CPU cores on windows by @staabm in https://github.com/paratestphp/paratest/pull/659

    New Contributors

    • @staabm made their first contribution in https://github.com/paratestphp/paratest/pull/659

    Full Changelog: https://github.com/paratestphp/paratest/compare/v6.4.3...v6.4.4

    Source code(tar.gz)
    Source code(zip)
  • v6.4.3(Feb 18, 2022)

    What's Changed

    • Require updated CodeCoverage analysis by @Slamdunk in https://github.com/paratestphp/paratest/pull/655

    Full Changelog: https://github.com/paratestphp/paratest/compare/v6.4.2...v6.4.3

    Source code(tar.gz)
    Source code(zip)
  • v6.4.2(Feb 18, 2022)

    What's Changed

    • Fix #629 JUnit log, create directory if not existent by @raneomik in https://github.com/paratestphp/paratest/pull/630
    • Fix propsal for issue #293: Display colors on code coverage by @nicumicle in https://github.com/paratestphp/paratest/pull/641
    • Dep update by @Slamdunk in https://github.com/paratestphp/paratest/pull/647
    • Upgrade to Infection 0.26 by @Slamdunk in https://github.com/paratestphp/paratest/pull/649
    • Correctly count test with a @depends relationship by @Slamdunk in https://github.com/paratestphp/paratest/pull/654

    New Contributors

    • @raneomik made their first contribution in https://github.com/paratestphp/paratest/pull/630
    • @nicumicle made their first contribution in https://github.com/paratestphp/paratest/pull/641

    Full Changelog: https://github.com/paratestphp/paratest/compare/v6.4.1...v6.4.2

    Source code(tar.gz)
    Source code(zip)
  • v6.4.1(Dec 2, 2021)

    What's Changed

    • Log file is empty: always output process outputs by @Slamdunk in https://github.com/paratestphp/paratest/pull/646

    Full Changelog: https://github.com/paratestphp/paratest/compare/v6.4.0...v6.4.1

    Source code(tar.gz)
    Source code(zip)
  • v6.4.0(Nov 30, 2021)

    What's Changed

    • Add support for Symfony 6, drop Symfony 4 by @loic425 in https://github.com/paratestphp/paratest/pull/639
    • Test on PHP 8.1 by @Slamdunk in https://github.com/paratestphp/paratest/pull/645

    New Contributors

    • @loic425 made their first contribution in https://github.com/paratestphp/paratest/pull/639

    Full Changelog: https://github.com/paratestphp/paratest/compare/v6.3.3...v6.4.0

    Source code(tar.gz)
    Source code(zip)
  • v6.3.3(Nov 19, 2021)

    What's Changed

    • Zero exit code if no tests executed (fixes #636) by @remorhaz in https://github.com/paratestphp/paratest/pull/640

    New Contributors

    • @remorhaz made their first contribution in https://github.com/paratestphp/paratest/pull/640

    Full Changelog: https://github.com/paratestphp/paratest/compare/v6.3.2...v6.3.3

    Source code(tar.gz)
    Source code(zip)
  • v6.3.2(Nov 3, 2021)

    What's Changed

    • Dep update by @Slamdunk in https://github.com/paratestphp/paratest/pull/635
    • Respect configuration options of text coverage by @LeoVie in https://github.com/paratestphp/paratest/pull/626

    New Contributors

    • @LeoVie made their first contribution in https://github.com/paratestphp/paratest/pull/626

    Full Changelog: https://github.com/paratestphp/paratest/compare/v6.3.1...v6.3.2

    Source code(tar.gz)
    Source code(zip)
  • v6.3.1(Aug 10, 2021)

  • v6.3.0(Apr 27, 2021)

  • v6.2.0(Jan 29, 2021)

  • v6.1.2(Dec 15, 2020)

  • v6.1.1(Dec 7, 2020)

  • v6.1.0(Dec 6, 2020)

  • v6.0.0(Nov 27, 2020)

    Full Changelog

    Implemented enhancements:

    • Replace WrapperRunner and SqliteRunner with file-based processes communication to drop proc_open in favor of Symfony\Process #526
    • Paratest hangs indefinitely with WrapperRunner and SqliteRunner #431
    • Replace proc_open with Symfony\Process #527 (Slamdunk)
    • Allow PHP 8.0 #461 (Slamdunk)

    Fixed bugs:

    • Sub-processes generate coverage/logging #518
    • Forbid custom PHPUnit binary as ParaTest is coupled with pinned PHPUnit version #528 (Slamdunk)
    • Print 100% ending progress #524 (Slamdunk)

    Closed issues:

    • PHP 8 compatibility #562
    • PHP Warning: Use of undefined constant T_MATCH #530
    • Support for phpunit --order-by #502
    • Refactor internal v4 code with better OOP for easier maintenance #480
    • Disable Generic.Formatting.MultipleStatementAlignment.NotSame sniff #475
    • Phar execution failure when a wrapper is used #364
    • Memory/Performance Optimizations when running Magento Test Suite #319

    Merged pull requests:

    • Sub-processes: skip XML-defined logs and cc #561 (Slamdunk)
    • [PHP 8] Warning: Private methods cannot be final as they are never overridden by other classes #559 (tugmaks)
    • Add support for Cobertura coverage format #557 (grachevko)
    • composer(deps-dev): update infection/infection requirement from ^0.18.0 to ^0.18.2 #553 (dependabot[bot])
    • composer(deps-dev): update phpstan/phpstan requirement from ^0.12.50 to ^0.12.52 #552 (dependabot[bot])
    • composer(deps-dev): update vimeo/psalm requirement from ^4.0.0 to ^4.0.1 #551 (dependabot[bot])
    • composer(deps-dev): update vimeo/psalm requirement from ^3.17.2 to ^3.17.2 || ^4.0.0 #550 (dependabot[bot])
    • Check test randomness outcome is deterministic with --random-order-seed set #549 (Slamdunk)
    • Support TeamCity file to be a FIFO #547 (Slamdunk)
    • Infection 0.18: ignore asserts #546 (Slamdunk)
    • Make unnecessary associative array a list #542 (Slamdunk)
    • Minor tools update #541 (Slamdunk)
    • Fix phpunit-wrapper from resetting variables in global scope in WrapperRunner #540 (proggga)
    • Add paratest tests execution in random sort #539 (proggga)
    • Add --log-teamcity option #537 (Slamdunk)
    • Make test suite compatible with PHPUnit 9.4 #536 (Slamdunk)
    • Fix phpunit/php-code-coverage deprecation #534 (Slamdunk)
    • RunnerWorker simplified #529 (Slamdunk)
    • Add mutation testing #510 (Slamdunk)
    Source code(tar.gz)
    Source code(zip)
  • 5.0.4(Aug 26, 2020)

  • 5.0.3(Aug 26, 2020)

  • 5.0.2(Aug 25, 2020)

  • 5.0.1(Aug 25, 2020)

  • 5.0.0(Aug 25, 2020)

    Full Changelog

    Implemented enhancements:

    • Allow setting custom temp directory #428
    • Use PHPUnit listeners #286
    • No info on failing / risky tests #282
    • Generic exceptions do not help #158

    Fixed bugs:

    • --stop-on-failure does not work with WrapperRunner #262
    • PHPUnit warnings and risky tests are ignored #235
    • CI: test compiled PHAR against a known passing suite #519 (Slamdunk)
    • Print footer consistent with PHPUnit #517 (Slamdunk)
    • Enable coverage from XML configuration file #514 (Slamdunk)
    • Support --stop-on-failure on WrapperRunner and SqliteRunner too #512 (Slamdunk)
    • Use native PHPUnit configuration loader #498 (Slamdunk)
    • Prove #68 is fixed #495 (Slamdunk)
    • Escape PHP_BINARY as well #486 (Slamdunk)

    Closed issues:

    • Support for PHPUnit 9.3 #503
    • Adopt strictier version policy and stick with latest PHPUnit version only #450
    • Ignored logging section in phpunit.xml file #442
    • Not handled configuration file #434
    • Code coverage merge doesn't seem to take @covers into account #400
    • Error passing coverage-text with --runner SqliteRunner #356
    • Coverage does not report error for missing whitelist #346
    • Coverage reports are different from PHPUnit #344
    • Excluded groups still appear to be run by default in paratest (different from PHPUnit behavior) #314
    • Could not run it on windows. Log file C:...\PT_61A9.tmp is empty. #306
    • Classes are not autoloaded when running tests #280
    • Support for logging section in phpunit.xml #72

    Merged pull requests:

    Source code(tar.gz)
    Source code(zip)
  • 4.2.0(Aug 10, 2020)

Owner
null
Provides generic data providers for use with phpunit/phpunit.

data-provider Installation Run composer require --dev ergebnis/data-provider Usage This package provides the following generic data providers: Ergebni

null 25 Jan 2, 2023
Qase-phpunit - Qase TMS PHPUnit reporter.

Qase TMS PHPUnit reporter Publish results simple and easy. How to integrate composer require qase/phpunit-reporter Example of usage The PHPUnit report

Qase TMS 6 Nov 24, 2022
Mockery - Designed as a drop in alternative to PHPUnit's phpunit-mock-objects library

Mockery Mockery is a simple yet flexible PHP mock object framework for use in unit testing with PHPUnit, PHPSpec or any other testing framework. Its c

Mockery 10.3k Jan 1, 2023
PHP libraries that makes Selenium WebDriver + PHPUnit functional testing easy and robust

Steward: easy and robust testing with Selenium WebDriver + PHPUnit Steward is a set of libraries made to simplify writing and running robust functiona

LMC s.r.o. 219 Dec 17, 2022
PHPUnit extension for database interaction testing.

This extension is no longer maintained DbUnit PHPUnit extension for database interaction testing. Installation Composer If you use Composer to manage

Sebastian Bergmann 224 Aug 20, 2022
Mock implementation of the Translation package, for testing with PHPUnit

PoP Translation - Mock Mock implementation of the Translation package, for testing with PHPUnit Install Via Composer composer require getpop/translati

PoP 1 Jan 13, 2022
Learn unit testing with PHPUnit.

PHPUnit Exercise Running PHPUnit ./vendor/bin/phpunit # with filter which tests to run ./vendor/bin/phpunit --filter <pattern> Running Pint ./vendor/

Nopal 2 Aug 23, 2022
The Pest Parallel Plugin

This repository contains the Pest Plugin Parallel. If you want to start testing your application with Pest, visit the main Pest Repository. Explore th

PEST 28 Dec 5, 2022
SimpleTest is a framework for unit testing, web site testing and mock objects for PHP

SimpleTest SimpleTest is a framework for unit testing, web site testing and mock objects for PHP. Installation Downloads All downloads are stored on G

SimpleTest 147 Jun 20, 2022
The most powerful and flexible mocking framework for PHPUnit / Codeception.

AspectMock AspectMock is not an ordinary PHP mocking framework. With the power of Aspect Oriented programming and the awesome Go-AOP library, AspectMo

Codeception Testing Framework 777 Dec 12, 2022
vfsStream is a stream wrapper for a virtual file system that may be helpful in unit tests to mock the real file system. It can be used with any unit test framework, like PHPUnit or SimpleTest.

vfsStream vfsStream is a stream wrapper for a virtual file system that may be helpful in unit tests to mock the real file system. It can be used with

null 1.4k Dec 23, 2022
Rector upgrades rules for PHPUnit

Rector Rules for PHPUnit See available PHPUnit rules Install composer require rector/rector-phpunit Use Sets To add a set to your config, use Rector\P

RectorPHP 34 Dec 27, 2022
Add mocking capabilities to Pest or PHPUnit

This repository contains the Pest Plugin Mock. The Mocking API can be used in regular PHPUnit projects. For that, you just have to run the following c

PEST 16 Dec 3, 2022
A sample RESTful API in Laravel with PHPunit test.

Laravel PHP Framework URL | URI | Action |

Fasil 9 Jul 11, 2020
PHPUnit Application Architecture Test

PHPUnit Application Architecture Test Idea: write architecture tests as well as feature and unit tests Installation Install via composer composer requ

null 19 Dec 11, 2022
PHPUnit to Pest Converter

PestConverter PestConverter is a PHP library for converting PHPUnit tests to Pest tests. Before use Before using this converter, make sure your files

null 10 Nov 21, 2022
Allows the running of PHPUnit within ExpressionEngine

EE Unit Tests EE Unit Tests is an Add-on for ExpressionEngine that allows developers to execute unit tests from the Command Line. EE Unit Tests uses P

Eric Lamb 6 Jan 14, 2022
Magento PHPUnit Integration

Magento PHPUnit Integration Magento is a quite complex platform without built in unit test suite, so the code is not oriented on running tests over it

EcomDev B.V. 303 Dec 18, 2022