verkkokauppacom / parallel-phpunit Goto Github PK
View Code? Open in Web Editor NEWParallel version of phpunit command line
Parallel version of phpunit command line
It would be great if the parallel-phpunit could return 0 exit code when some test failed and 1 exit code if all tests ran fine.
Now that my tests actually work, I noticed that errors are not counted in the summary which is printed all the time.
Check out my proof: http://cl.ly/image/3q1w0x3K320y
When all phpunit commands are finnished the execution will end. The exit status is 0 if all phphunit commands return 0 otherwice it is 1.
If there is a test execution that results with exit(1);
, the return code is not registered as a test failure by parallel-phpunit.
<?php
class exitTest
{
public function test_exitDuringTest() {
echo 'about to exit...';
exit(1);
}
}
Output:
$ parallel-phpunit --pu-verbose .
Running parallel-phpunit 1.3.0
Starting command: /usr/local/bin/phpunit -d parallel-phpunit-thread=0 ./exitTest.php
Command ended: /usr/local/bin/phpunit -d parallel-phpunit-thread=0 ./exitTest.php
PHPUnit 4.2.4 by Sebastian Bergmann.
Configuration read from /tests/phpunit.xml
about to exit...Success: 0 Fail: 0 Error: 0 Skip: 0 Incomplete: 0
If you installed parallel-phpunit using composer it should use ./vendor/bin/phpunit as default command and not the global installation. (In my case, I even deleted the global installation since I have phpunit shipped with a project using composer).
So at the moment I have to run the following command
./vendor/bin/parallel-phpunit --pu-cmd vendor/bin/phpunit .
More convenient would be just
./vendor/bin/parallel-phpunit .
Hi, hopefully you can help here. I use Sauce labs and CircleCI as continuous integration. I'm having a weird issue, allow me to describe...
When I use composer.json to add "verkkokauppacom/parallel-phpunit": "dev-master"
on my local Ubuntu machine, composer takes care of everything seemingly nice, as I witness that the folder verkkokauppacom/parallel-phpunit/ gets fully-populated with the expected subdirectories (bin, example, tests) and additional files .git, composer.json, and release, and README.md
These files, just FYI, are part of a project that I also track in github, and when I push files to my remote repository, the directory verkkokauppacom/parallel-phpunit/ is empty.
Here is what occurs when composer installs the files:
`Loading composer repositories with package information
Installing dependencies (including require-dev) from lock file
Installing verkkokauppacom/parallel-phpunit (dev-master 84f2cea)
Cloning 84f2cea
Skipped installation of bin bin/parallel-phpunit for package verkkokauppacom/parallel-phpunit: name conflicts with an existing file
Generating autoload files`
If I remove the files from my local machine completely, and then push up the difference to my remote, and tell CircleCI to use composer to get the files, all is good again.
Any ideas?
@siivonen try new version: https://github.com/razielsd/parallel-phpunit2
I don't know if you follow certain ideas with the solution by now supporting a single phpunit.xml in the root directory as phpunit does it. But I think if you would support this behavior it would be more straight-forward for "native phpunit" users ;)
So if I currently run ./vendor/bin/parallel-phpunit --pu-cmd vendor/bin/phpunit .
my complete directory gets tested and not the files I selected in the phpunit.xml. So also all tests in my vendor directory are executed.
Please let me know about your thoughts on this. Have you intended this way or just haven't implemented phpunit.xml support yet.
Cheers!
Produces only
sh: parallel-phpunit: not found
It will be nice to have same output as original phpunit have. Right now I see something strange:
$ bin/parallel-phpunit example/
Running parallel wrapper for phpunit
Starting command: phpunit example//1
Starting command: phpunit example//2
Starting command: phpunit example//5/6
Success: 1 Fail: 0 Error: 0 Skip: 0 Incomplete: 0
Command ended: phpunit example//5/6
Command ended: phpunit example//1
PHPUnit @package_version@ by Sebastian Bergmann.
.
Time: 2 seconds, Memory: 5.00Mb
OK (1 test, 1 assertion)
PHPUnit @package_version@ by Sebastian Bergmann.
.
Time: 2 seconds, Memory: 5.00Mb
OK (1 test, 1 assertion)
Command ended: phpunit example//2
PHPUnit @package_version@ by Sebastian Bergmann.
...
Time: 3 seconds, Memory: 5.25Mb
OK (3 tests, 3 assertions)
Success: 5 Fail: 0 Error: 0 Skip: 0 Incomplete: 0
What about adding new parameter for less output, or parameter for more output like a --pu--verbose? I think that is enough to write on output only this line:
Success: 536 Fail: 0 Error: 0 Skip: 0 Incomplete: 0
after succesfully performed test. And if test ends with error, then should by good to write output from test. That helps to better orientation in output
I have small changes :)
1 .Run test by file (now by dir)
2. Thread limit
3. Thread number for easy use selenium servers pool
4. Can use custom phpunit runner
5. Test file mask
When you wanna merge, i'm send pool request.
When test ends for example with this warning:
PHP Warning: require_once(/home/extranet/web/library/Config.php): failed to open stream
Then should be marked as failed. It helps to run tests in parallel automatically and checks only the last line "Success: 542 Fail: 0 Error: 0 Skip: 0 Incomplete: 0"
I've used parallel-phpunit
in various small projects and like it a lot for its simplicity. However it has obvious drawbacks and limitations. It seems someone else has taken the effort of going the extra mile.
Would it be interesting to seek a collaboration with https://github.com/brianium/paratest? I think both projects would benefit from it.
When I use parallel-phpunit in my root test directory, only the BootstrapTest.php file which is located directly in the root directory is used. No subdirectory is analysed or used for a test-run.
Using phpunit, the subdirectories are used as expected.
parallel-phpunit . > 1 file tested
phpunit . > all files tested
My phpunit.xml isn't fancy at all.
<phpunit bootstrap="./bootstrap.php" colors="true"></phpunit>
Any hints as to why that happens?
Thanks!
Best,
Philipp
First of: thanks for the great tool! It's pretty useful for running selenium tests :)
Now to the issue: I noticed that after exiting there are still some log files present created by pu. Is this a bug or a feature?
Edit: I am refering to the parallel-phpunit.* files.
looks like a typo:
ROOT="${@:-1}" # last argument
should be:
ROOT="${@: -1}" # last argument
Please make this package available via https://packagist.org/
I think that way you get a lot more feedback and improvement suggests ๐
I've been running some tests but it seems parallel-phpunit just runs fine, without reporting any errors, if there is a php error. Look at the log excerpt I've attached.
(...)
Success: 0 Fail: 0 Error: 0 Skip: 0 Incomplete: 0
Command ended: /usr/bin/phpunit -d parallel-phpunit-thread=1 ./b3Test.php
PHPUnit 3.7.21 by Sebastian Bergmann.
PHP Fatal error: Call to undefined function fuckItUp() in /var/www/t/b/b3Test.php on line 54
PHP Stack trace:
PHP 3. PHPUnit_TextUI_Command->run() /usr/share/php/PHPUnit/TextUI/Command.php:129
PHP 4. PHPUnit_TextUI_TestRunner->doRun() /usr/share/php/PHPUnit/TextUI/Command.php:176
PHP 5. PHPUnit_Framework_TestSuite->run() /usr/share/php/PHPUnit/TextUI/TestRunner.php:349
PHP 6. PHPUnit_Framework_TestSuite->runTest() /usr/share/php/PHPUnit/Framework/TestSuite.php:745
PHP 7. PHPUnit_Framework_TestCase->run() /usr/share/php/PHPUnit/Framework/TestSuite.php:775
PHP 8. PHPUnit_Framework_TestResult->run() /usr/share/php/PHPUnit/Framework/TestCase.php:776
PHP 9. PHPUnit_Framework_TestCase->runBare() /usr/share/php/PHPUnit/Framework/TestResult.php:648
PHP 10. PHPUnit_Framework_TestCase->runTest() /usr/share/php/PHPUnit/Framework/TestCase.php:831
PHP 11. ReflectionMethod->invokeArgs() /usr/share/php/PHPUnit/Framework/TestCase.php:976
PHP 12. b3Test->test1() /usr/share/php/PHPUnit/Framework/TestCase.php:976
Starting command with thread 1: /usr/bin/phpunit -d parallel-phpunit-thread=1 ./b2Test.php
./b5Test.php
Success: 1 Fail: 0 Error: 0 Skip: 0 Incomplete: 0
Success: 1 Fail: 0 Error: 0 Skip: 0 Incomplete: 0
Success: 1 Fail: 0 Error: 0 Skip: 0 Incomplete: 0
(...)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.