facile-it / paraunit Goto Github PK
View Code? Open in Web Editor NEWRun PHPUnit tests in parallel
Home Page: https://engineering.facile.it/paraunit/
License: Apache License 2.0
Run PHPUnit tests in parallel
Home Page: https://engineering.facile.it/paraunit/
License: Apache License 2.0
To support windows, those stuff is needed:
DIRECTORY_SEPARATOR
when generating filenames for logs and coverageI think it could turn useful to have a CONTRIBUTING.md file.
Nothing fancy just some basic tasks to run before submitting a PR and maybe the general guidelines.
More so, Paraunit docker container comes packed with all the tools required to follow these rules, particularly (but not only):
It would be even better to provide a custom version of the of such tools, even a contributing.sh with multiple tasks inside. Something that a developer can run before submitting his contribution.
TO DO
As from title
When an abnormal termination with no output is being reported, we should handle that with a specific message, or it would be unclear what happened.
As in title.
https://travis-ci.org/facile-it/paraunit/jobs/81814347
PHP7 and HHVM handle fatal errors as errors.... We should fix the parsing (and the build!)
Right now, we have a lot of duplication between Error\Failure\Warning parsers; the same is true for the process interface, where we have a lot of getter/setters/hassers. It then pour out to the printers, where we have a lot of duplication in the containers of the parser results.
Refactor is needed to boil it down to just one type of class with multiple identifies (constants?) on all 3 sides of this issue.
Proposed path:
OutputContainer
s into corresponding parsersOutputContainer
ProcessOutputParser
a dependency of FinalPrinter
ProcessOutputParser
OutputContainer
through parsersOutputContainer
init value as a tag on the console formatterConsoleFormatter
New course of action:
ProcessFactory
adds the option for JSON logging to a temp dir (/dev/shm
?)PHPUnit (at least in version 5) prints output when a test is skipped with a message. We should parse them!
Using sqlite as database with parallel functional tests I found this error that is not matched to retry
SQLSTATE[HY000]: General error: 5 database is locked (SQL: insert into "wallets" ("name", "user_id", "updated_at", "created_at") values (test_wallet, 1, 2015-11-25 21:07:38, 2015-11-25 21:07:38))
I think that we should distribute paraunit as a phar archive in order to allow users to simply wget it from our site and than use it without the need of anything else than php
Documentation needs info about the new coverage command, about its usage and requirements.
Hi, would be nice to have --group and --exclude-group support
PHPUnit has support for test result logging (more info here). Paraunit could use these instead of parsing stdout which may contain garbage data (eg. var_dumps).
@fntlnz Do you know if PHP7 and HHVM still output
segmentation fault (core dumped)
In case of a segmentation fault?
For what i can see after commit 0dfc77b the output seem to be quite different.
HHVM:
Fatal error: String length exceeded 2^31-2: 18446744071626162096 in [...]
PHP7:
Fatal error: Out of memory (allocated 4194304) (tried to allocate 799999999999952 bytes) in [..]
Looks like we should skip abstract classes in the test folder.
Few examples in Symfony
https://github.com/symfony/symfony/blob/master/src/Symfony/Component/Validator/Tests/Validator/AbstractTest.php
https://github.com/symfony/symfony/blob/master/src/Symfony/Component/Form/Tests/AbstractFormTest.php
Abnormal Terminations (fatal Errors, Segfaults) output:
1) UNKNOWN -- log not found
Abnormal termination -- complete test output:
Class '/home/travis/build/laboro/dev/package/platform/src/Oro/Bundle/TranslationBundle/Tests/Functional/ImportExport/Strategy/AbstractTranslationImportStrategyTest' could not be found in '/home/travis/build/laboro/dev/package/platform/src/Oro/Bundle/TranslationBundle/Tests/Functional/ImportExport/Strategy/AbstractTranslationImportStrategyTest.php'.
Today I've broken the build twice (4d31ec1 & 2e5b5ee) because I was using []
instead of array()
and the ::class
static shortcut for Prophecy.
PHP 5.3 is alread dead, and 5.4 is already on extended support, and it will dead 1 month from now: http://php.net/supported-versions.php
I propose to push the minimum support to 5.5, to encourage the usage of the supported version.
I was wondering if it's not time to build a documentation website for this project.
Something like this would be very nice: https://facebook.github.io/watchman/
After a quick chat on Twitter last night, @taueres suggested to me to use exit(139)
as a way to emulate test segfaults in Paraunit's testsuite. Since we ditched output parsing in favor of JSON logs, this should be feasible.
With commit 75cfc1f, Paraunit started to pull up files reading the xml config file. It needs to be improved:
prefix
elementssuffix
elementsexclude
elementsfile
elementsWhen using the --configuration
option, we are forced to specify the file name. We should emulate PHPUnit's behaviour, append the default filename (phpunit.xml.dist
) if it's not specified.
I would like to make the shark logo optional or configurable with the stable release. It was nice for the unstable, but I think it may look "personalized" for a software that we like to distribute.
I would like to support more option to select test, other than testsuite definition. Please, suggest what you would like to see supported.
Options:
--group
CLI parameterIt should be splitted into multiple classes, listeners to the same event, with the right priority.
With most of the execution option behing ralyed tho the child processes here #57
it would be an interesting feature to have Paraunit handle further execution option, especially the ones that could make sense in the global execution or are non-relevant for the child processes.
In this case the the focus of this issue is on:
--stop-on-error
To avoid misunderstanding and promote ease-of-use the behavior should be as similar as possible to the phpunit documentation:
--stop-on-error Stop execution upon first error.
--stop-on-failure Stop execution upon first error or failure.
--stop-on-risky Stop execution upon first risky test.
--stop-on-skipped Stop execution upon first skipped test.
--stop-on-incomplete Stop execution upon first incomplete test.
Contrary to phpunit, paraunit execution is parallel by definition and for this reason it's hard to actually stop all running process if on of them return an error.
In this case it could be a best effort and stop the spawning of new processes, disregarding the output of running ones and printing all accumulated output.
With this approach the original idea behind the --stop-on-error should be maintained as the execution will terminate with an ASAP policy.
After testing #59 I found that the PHPDbg support is lacking:
PHPDbgBinFile::isAvailable()
fails: probably file_exist doesn't have enough permissionsSebastianBergmann\CodeCoverage\RuntimeException
, probably when merging the coverage, if xdebug is missingI've noticed that php warnings are marked as F but build return code is 0. Why not mark them as W or something similar ?
I would like to bump the supported versions for those deps with the 1.0 stable release:
This means also a few optimizations in the works:
::class
everywherestrict_types=1
everywheresetExpectedException
, ...)symfony/phpunit-bridge
)RegisterListenersPass
workaroundRunnerTest::testWarning
JSON_PRETTY_PRINT
, it's there since 5.6.1assertFile[Not]Exists
Since PHP 7 is in the process of being released IMHO we should consider start supporting it right now.
A first step to do this could be to tell travis to build the project against it as described here
Are we considering to support this under HHVM?
We should write what driver is in use before launching all the tests
Yesterday I tried launching the coverage command over a very large codebase. The execution failed due to not having space to save the logs and the coverage results. We should delete the logs and the files right after reading them, to save on space while executing the tests.
As it is, the output generated by --debug
option is not very clear, it needs to be improved.
Paraunit execution remains blocked waiting for long functional tests that are running at the end.
I'm working on a solution to eliminate the waiting time for these last long tests.
The idea is to extract the process stack creation into a service that can use some different strategies to "build" the stack.
One strategy (the default one) is the actual strategy, the other one creates an index with the timing of execution of every single test class and builds a stack based on this index.
With this strategy the longer tests will be executed for first, optimizing the execution and eliminating the long final wait time.
I'm thinking to use different adapters (File, db, others ..) to store che "index" and i would use some sort of configuration to drive it.
I'm thinking about use dotEnv for this purpoose (actually i'm using the command)
Can this solution be usefull?
Here is my forked project development
I think that paraunit needs some sort of configuration file to set actual and future parameters, for example for portability in CI environments.
I want to propose this implementation using dotEnv feature_dotenv_configuration
I was updating the Paraunit site for documentation, and the phpcs
hook fired and failed (the src/ folder was missing!)
We should change the script to "blacklist" the branches relatives to the site
If an output containers receives a null
or emptry string as a message, they should discard them, to avoid spamming in the final output.
The same should be true for skipped and incomplete empty messages, as Skipped Test:
or Incomplete Test:
, that are triggered when no string is passed to the markTestAsSkipped()
or markTestAsIncomplete()
functions.
I've started to work to a new feature, a command that produces code coverage with Paraunit.
I'll merge the branch ASAP, and I'll use this issue to track the progress.
feature-coverage
to master[...]
Right now, our composer.json
forbids the use of PHPUnit 5.x.
I would like to rise that limit; we need to test if there is any BC break that will impede that.
I do not see any colored output using the master branch. Maybe #7 broke something about the console formatters?
License owner and copyright year are missing from the LICENSE
file.
https://github.com/facile-it/paraunit/blob/master/LICENSE#L189
PHPUnit implemented warnings: sebastianbergmann/phpunit#1802
Paraunit should be able to parse them.
The goal 1510_paraunit_funfair it's to provide some dockerfiles used for running paraunit against some well consolidated testsuites.
By running:
./testbench/monolog/setup.sh
The script will hijack docker mounting functionality putting paraunit source directly inside monolog vendor.
It will be possible to run paraunit against monolog while playing with the source.
sample output:
B>
B "Bp
.pp.. B 9p
"9BBBBBBpp. B 9p
" ""9BBBBBBpp .<eeP"B B .B b
"SANDROBpp . B B B B )B B
"BFRABBBB> .<pe6P\B B B B B B $ B .e
5NICOBBB B ·B B B B B Bqp. :B B $ 4BBpp
BMIKIB B B B B B B "^Bp B ) |BBB"\BBpp.
.BALEBBB """9q. B"""""B B"""""B B 1p B""""9p BBBBbBBBBBBB
<BLUCABBBB B "B B B B B B B B 9 9BBB< ^P"
.6BSERGIOBBBB B666666B B B B B B 9 P 7 9BBBBP
PARAUNIT V0.4 - by Francesco Panina, Alessandro Lai and Shark Dev Team @ Facile.it
....................................................SS..........................
..................................................................E.............
................................................................................
................................................................................
................................................................................
................................................................................
................................................................................
................................................................................
.........................................................SSSS...................
...................S.....S....................S.......................SSSSSSSS..
........................................
Execution time -- 00:00:05
Executed: 68 test classes, 840 tests
ERRORS output:
1) Monolog\Handler\RavenHandlerTest::testUserContext
Undefined index: sentry.interfaces.User
/tmp/monolog/tests/Monolog/Handler/RavenHandlerTest.php:120
1 files with ERRORS:
RavenHandlerTest.php
6 files with SKIPPED:
ZendMonitorHandlerTest.php
GelfHandlerLegacyTest.php
ElasticSearchHandlerTest.php
CouchDBHandlerTest.php
AmqpHandlerTest.php
MongoDBFormatterTest.php
It would be nice to compile PHP from source (using one of the official PHP docker images) rather than relaying to Debian's repository.
This would give us the ability to easily create 2 docker images:
and also keep the container cleaner.
what do you think?
The file composer.phar should not be part of the project. It's also quite bit ~1 MB.
I suggest to remote it and add a new .gitignore rule.
As stated in #7 's comments, we should move the Retry logic into the RetryParser. As a matter of fact, the manager now just parses the output!
Currently, we use PHPUnit plugins to track single test case duration.
Plugins reporting to output will not work with JSON approach in Paraunit
Would be good to have an ability to track single test case memory and time consumption.
Threshold option might filter results not to report all tests
Another option might control test case failure in case test case is slow or a lot of memory used
I think that would be nice if paraunit can generate the PHPUnit testdox in parallel, what do you think?
I was trying to use Paraunit in a project where the .xml config file isn't in the root dir of the project itself.
This causes an issue: the test suites are defined with relative paths, but they are relative to the config file position. This must be fixed.
When the --configuration
parameter is passed to paraunit, the filename should be stripped from the value, and the remaining is to be prepended to every file test path when launching the PHPUnit processes.
I've just discovered that you can disable PHPUnit colors in CLI with:
--colors=never
I would like to enforce it on every PHPUnit process that Paraunit launches, to avoid parsing problems and to remove from requirements the disable of colors from the XML config file.
BTW, I need first to investigate from which version of PHPUnit this option is supported... I think I'll open an issue on PHPUnit because this option is undocumented.
@Jean85 With commit 9d4bf8e we can now add a lifecycle logic to the runner.
With this little upgrade it will be easier to add any new behavior such:
At the present time we only have engine.before_start which is hooked to the output formatter and shark printer but the infrastructure is there!
My proposal is to move some dependency away from the runner so it will be easier to unit test.
As a side note, using events in key areas will improve the system extensibility.
As from title.
Maybe we should reuse the output redirection?
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.