Run your Selenium tests in parallel with PHPUnit
One of the advantages of running your Selenium tests on the TestingBot grid is that we scale depending on your needs. If you need to run 100 Selenium tests, it might take some time for them to finish if you run them one after another.
By running tests in parallel, you can dramatically reduce the time it takes to run all your Selenium tests. The same 100 tests can be run x times faster by running them in parallel.
Recently one of our customers asked for a solution to perform parallel testing in PHPUnit. To our surprise this has been on the PHPUnit todo list for a long time, but is still not supported.
We have created a PHP wrapper script which will collect all the PHPUnit files in the directory you specify and run them in parallel. You can specify how many tests you want to run at the same time. At the end of the run, the script will echo the results per PHPUnit file.
An example of how to use this script:
php parallel.php -d tests/ -m 5
This will run all tests in the tests directory with maximum 5 simultaneous tests running. Together with our scaleable grid, parallel testing will make your tests results available much faster.
Our GitHub repository with the parallel PHPUnit code: https://github.com/testingbot/phpunit-parallel.
< Back to Blog Overview