forked from oroinc/platform
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
BAP-10564: Provide ability to automatically split functional tests in…
…to equal test suites 1) functional-x-of-y test suites were removed Those suites caused a lot of issues when we miss some tests in suites (often issue for extensions), and they become broken afterward. For now, please use --testsuite=functional and use folder argument or filter tests using built-in PHPUnit functionality in case you need to run some specific tests, see examples below: ``` bin/phpunit --testsuite=functional bin/phpunit --testsuite=functional vendor/oro/platform/src/Oro/Bundle/TestFrameworkBundle/Tests/Functional bin/phpunit --testsuite=functional --filter="TestFrameworkBundle\\\\Tests\\\\Functional" ``` The bundle-based approach used on Travis and Jenkins. We collect a list of existing bundles and run them in parallel threads one by one. 2) GNU Parallel applied for Travis instead of custom shell scripts. GNU Parallel job report printed in `if [ -z "$TRAVIS_SKIP" ]; then ./.travis/$TESTSUITE.sh after_script; fi` section. Few tips how to use it for development (run commands from application folder). The 2017 year edition required, check it using `parallel --version` and do not forget to record environment using `parallel --record-env` command # dependencies COMPOSER=dev.json composer install -o --profile PHPCS: find -L vendor/oro -type f -name "*.php" | parallel --no-notice --gnu -k --lb --env _ --xargs --joblog app/logs/parallel.log php bin/phpcs {} -p --encoding=utf-8 --extensions=php --standard=vendor/oro/platform/build/phpcs.xml; PHPMD for OroPlatform and OroCRM: find -L vendor/oro -type f -name "*.php" | parallel --no-notice --gnu -k --lb --env _ --xargs --joblog app/logs/parallel.log 'files="{}"; php bin/phpmd ${files// /,} text vendor/oro/platform/build/phpmd.xml --suffixes php' PHPMD for OroCommerce: find -L vendor/oro -type f -name "*.php" | grep -i commerce | parallel --no-notice --gnu -k --lb --env _ --xargs --joblog app/logs/parallel.log 'files="{}"; php bin/phpmd ${files// /,} text vendor/oro/commerce/build_config/phpmd.xml --suffixes php' # dependencies npm install --prefix=vendor/oro/platform/build/ JSCS: find -L vendor/oro -type f -name "*.js" | grep -iv node_modules | parallel --no-notice --gnu -k --lb --env _ --xargs --joblog app/logs/parallel.log 'vendor/oro/platform/build/node_modules/.bin/jscs {} --config=vendor/oro/platform/build/.jscsrc' JSHINT: find -L vendor/oro -type f -name "*.js" | grep -iv node_modules | parallel --no-notice --gnu -k --lb --env _ --xargs --joblog app/logs/parallel.log 'vendor/oro/platform/build/node_modules/.bin/jshint {} --config=vendor/oro/platform/build/.jshintrc --exclude-path=vendor/oro/platform/build/.jshintignore' 3) \Oro\Bundle\TestFrameworkBundle\Tests\Functional\InstallerTest added to check that installers are up to date with migrations and no uncovered migration left. Executed for installation only (jobs with upgrades skipped) and excluded from test suites by default. To run it locally use next command bin/phpunit --testsuite functional --group=install 4) bootstrap.php files for PHPUnit were removed. Symfony PHPUnit Bridge handles bootstrapping now. 5) phpunit.xml.dist were actualized. Templates for those files created in package/platform/build folder 6) phpcpd was upgraded to dev-master branch, locked using hash until it's next release, allows us to use regexp in excludes, like bin/phpcpd --min-lines 25 --verbose --progress --regexps-exclude=Migrations/Schema/,Entity/ vendor/oro/commerce 7) Segfaults. Switching to per bundle approach reduces segfault chances. If you still have segfaults on your build just add GDB=true variable to failed job and uncomment gdb package, you will get segfault report and will be able to detect wrong code. 8) New dependency, phploc/phploc under BSD 3-clause license, used to generate coverage report, will be applied in a few weeks to our CI flow
- Loading branch information
Showing
62 changed files
with
1,594 additions
and
891 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,3 +8,4 @@ composer.lock | |
phpunit.xml | ||
*~ | ||
node_modules | ||
/components |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
**/.bin/** | ||
../../**/node_modules/** | ||
../../**/public/lib/** | ||
../../**/public/*/vendors/** | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,137 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
|
||
<!-- https://phpunit.de/manual/current/en/appendixes.configuration.html --> | ||
<phpunit | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/5.7/phpunit.xsd" | ||
backupGlobals="false" | ||
backupStaticAttributes="false" | ||
bootstrap="vendor/autoload.php" | ||
cacheTokens="true" | ||
stopOnError="false" | ||
stopOnFailure="false" | ||
stopOnWarning="false" | ||
stopOnIncomplete="false" | ||
stopOnRisky="false" | ||
stopOnSkipped="false" | ||
failOnRisky="false" | ||
failOnWarning="true" | ||
beStrictAboutChangesToGlobalState="false" | ||
beStrictAboutOutputDuringTests="false" | ||
beStrictAboutResourceUsageDuringSmallTests="false" | ||
beStrictAboutTestsThatDoNotTestAnything="false" | ||
beStrictAboutTodoAnnotatedTests="false" | ||
beStrictAboutCoversAnnotation="false" | ||
checkForUnintentionallyCoveredCode="false" | ||
enforceTimeLimit="false" | ||
verbose="false"> | ||
|
||
<groups> | ||
<exclude> | ||
<group>dist</group> | ||
<group>install</group> | ||
</exclude> | ||
</groups> | ||
<testsuites> | ||
<testsuite name="unit"> | ||
<directory>vendor/oro/*/Tests/Unit</directory> | ||
<directory>vendor/oro/*/*/Tests/Unit</directory> | ||
<directory>vendor/oro/*/*/*/Tests/Unit</directory> | ||
<directory>vendor/oro/*/*/*/*/Tests/Unit</directory> | ||
<directory>vendor/oro/*/*/*/*/*/Tests/Unit</directory> | ||
</testsuite> | ||
<testsuite name="functional"> | ||
<directory>vendor/oro/*/Tests/Functional</directory> | ||
<directory>vendor/oro/*/*/Tests/Functional</directory> | ||
<directory>vendor/oro/*/*/*/Tests/Functional</directory> | ||
<directory>vendor/oro/*/*/*/*/Tests/Functional</directory> | ||
<directory>vendor/oro/*/*/*/*/*/Tests/Functional</directory> | ||
</testsuite> | ||
<testsuite name="selenium"> | ||
<directory>vendor/oro/*/Tests/Selenium</directory> | ||
<directory>vendor/oro/*/*/Tests/Selenium</directory> | ||
<directory>vendor/oro/*/*/*/Tests/Selenium</directory> | ||
<directory>vendor/oro/*/*/*/*/Tests/Selenium</directory> | ||
<directory>vendor/oro/*/*/*/*/*/Tests/Selenium</directory> | ||
</testsuite> | ||
</testsuites> | ||
<php> | ||
<env name="SYMFONY_ENV" value="test"/> | ||
<env name="SYMFONY_DEBUG" value="0"/> | ||
<env name="SYMFONY_DEPRECATIONS_HELPER" value="weak" /> | ||
<ini name="error_reporting" value="-1"/> | ||
<ini name="memory_limit" value="-1"/> | ||
<server name="KERNEL_DIR" value="app/"/> | ||
<const name="PHPUNIT_LOAD_LIMIT" value="1.2"/> | ||
<const name="PHPUNIT_PAGE_LIMIT" value="0.5"/> | ||
<const name="PHPUNIT_TESTSUITE_BROWSER_PATH_WINNT" value="C:\Dev\phantomjs-1.9.0-windows\phantomjs.exe"/> | ||
<const name="PHPUNIT_TESTSUITE_BROWSER_PATH_LINUX" value="/usr/bin/phantomjs"/> | ||
<!--<const name="PHPUNIT_TESTSUITE_BROWSER_PATH_LINUX" value="/usr/bin/google-chrome"/>--> | ||
<!--<const name="PHPUNIT_TESTSUITE_BROWSER_PATH_LINUX" value="/usr/bin/firefox"/>--> | ||
<const name="PHPUNIT_TESTSUITE" value="true"/> | ||
<const name="PHPUNIT_TESTSUITE_EXTENSION_SELENIUM_HOST" value="127.0.0.1"/> | ||
<const name="PHPUNIT_TESTSUITE_EXTENSION_SELENIUM_PORT" value="4444"/> | ||
<const name="PHPUNIT_TESTSUITE_EXTENSION_SELENIUM2_BROWSER" value="phantomjs"/> | ||
<!--<const name="PHPUNIT_TESTSUITE_EXTENSION_SELENIUM2_BROWSER" value="chrome"/>--> | ||
<!--<const name="PHPUNIT_TESTSUITE_EXTENSION_SELENIUM2_BROWSER" value="firefox"/>--> | ||
<const name="PHPUNIT_TESTSUITE_EXTENSION_SELENIUM_TESTS_URL" value="http://localhost.com"/> | ||
<const name="PHPUNIT_TESTSUITE_EXTENSION_SELENIUM_TESTS_URL_COVERAGE" | ||
value="http://localhost.com/bundles/orotestframework/scripts/phpunit_coverage.php"/> | ||
<const name="MAX_EXECUTION_TIME" value="240000"/> | ||
<const name="TIME_OUT" value="5000"/> | ||
<const name="viewportWIDTH" value="1900"/> | ||
<const name="viewportHEIGHT" value="1080"/> | ||
<const name="PHPUNIT_TESTSUITE_EXTENSION_SELENIUM_PATH_LOGS" value="app/log"/> | ||
<const name="PHPUNIT_TESTSUITE_EXTENSION_SELENIUM_LOGIN" value="admin"/> | ||
<const name="PHPUNIT_TESTSUITE_EXTENSION_SELENIUM_PASS" value="admin"/> | ||
</php> | ||
<listeners> | ||
<listener class="JohnKary\PHPUnit\Listener\SpeedTrapListener"> | ||
<arguments> | ||
<array> | ||
<element key="slowThreshold"> | ||
<integer>1000</integer> | ||
</element> | ||
</array> | ||
</arguments> | ||
</listener> | ||
<listener class="Symfony\Bridge\PhpUnit\SymfonyTestsListener"/> | ||
<listener class="MyBuilder\PhpunitAccelerator\TestListener"/> | ||
</listeners> | ||
<filter> | ||
<whitelist> | ||
<directory>vendor/oro</directory> | ||
<exclude> | ||
<directory>vendor/oro/*/Command</directory> | ||
<directory>vendor/oro/*/*/Command</directory> | ||
<directory>vendor/oro/*/*/*/Command</directory> | ||
<directory>vendor/oro/*/*/*/*/Command</directory> | ||
<directory>vendor/oro/*/*/*/*/*/Command</directory> | ||
|
||
<directory>vendor/oro/*/Controller</directory> | ||
<directory>vendor/oro/*/*/Controller</directory> | ||
<directory>vendor/oro/*/*/*/Controller</directory> | ||
<directory>vendor/oro/*/*/*/*/Controller</directory> | ||
<directory>vendor/oro/*/*/*/*/*/Controller</directory> | ||
|
||
<directory>vendor/oro/*/Entity/Repository</directory> | ||
<directory>vendor/oro/*/*/Entity/Repository</directory> | ||
<directory>vendor/oro/*/*/*/Entity/Repository</directory> | ||
<directory>vendor/oro/*/*/*/*/Entity/Repository</directory> | ||
<directory>vendor/oro/*/*/*/*/*/Entity/Repository</directory> | ||
|
||
<directory>vendor/oro/*/Migrations</directory> | ||
<directory>vendor/oro/*/*/Migrations</directory> | ||
<directory>vendor/oro/*/*/*/Migrations</directory> | ||
<directory>vendor/oro/*/*/*/*/Migrations</directory> | ||
<directory>vendor/oro/*/*/*/*/*/Migrations</directory> | ||
|
||
<directory>vendor/oro/*/Tests</directory> | ||
<directory>vendor/oro/*/*/Tests</directory> | ||
<directory>vendor/oro/*/*/*/Tests</directory> | ||
<directory>vendor/oro/*/*/*/*/Tests</directory> | ||
<directory>vendor/oro/*/*/*/*/*/Tests</directory> | ||
</exclude> | ||
</whitelist> | ||
</filter> | ||
</phpunit> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
|
||
<!-- https://phpunit.de/manual/current/en/appendixes.configuration.html --> | ||
<phpunit | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/5.7/phpunit.xsd" | ||
backupGlobals="false" | ||
backupStaticAttributes="false" | ||
bootstrap="vendor/autoload.php" | ||
cacheTokens="true" | ||
stopOnError="false" | ||
stopOnFailure="false" | ||
stopOnWarning="false" | ||
stopOnIncomplete="false" | ||
stopOnRisky="false" | ||
stopOnSkipped="false" | ||
failOnRisky="false" | ||
failOnWarning="true" | ||
beStrictAboutChangesToGlobalState="false" | ||
beStrictAboutOutputDuringTests="false" | ||
beStrictAboutResourceUsageDuringSmallTests="false" | ||
beStrictAboutTestsThatDoNotTestAnything="false" | ||
beStrictAboutTodoAnnotatedTests="false" | ||
beStrictAboutCoversAnnotation="false" | ||
checkForUnintentionallyCoveredCode="false" | ||
enforceTimeLimit="false" | ||
verbose="false"> | ||
|
||
<testsuites> | ||
<testsuite name="unit"> | ||
<directory>Tests/Unit</directory> | ||
<directory>src/*/Tests/Unit</directory> | ||
<directory>src/*/*/Tests/Unit</directory> | ||
<directory>src/*/*/*/Tests/Unit</directory> | ||
<directory>src/*/*/*/*/Tests/Unit</directory> | ||
<directory>src/*/*/*/*/*/Tests/Unit</directory> | ||
<directory>src/*/*/*/*/*/*/Tests/Unit</directory> | ||
<directory>src/*/*/*/*/*/*/*/Tests/Unit</directory> | ||
</testsuite> | ||
</testsuites> | ||
|
||
<php> | ||
<env name="SYMFONY_ENV" value="test"/> | ||
<env name="SYMFONY_DEBUG" value="0"/> | ||
<env name="SYMFONY_ENV" value="test"/> | ||
<env name="SYMFONY_DEPRECATIONS_HELPER" value="weak" /> | ||
<ini name="error_reporting" value="-1"/> | ||
<ini name="memory_limit" value="-1"/> | ||
</php> | ||
<listeners> | ||
<listener class="JohnKary\PHPUnit\Listener\SpeedTrapListener"> | ||
<arguments> | ||
<array> | ||
<element key="slowThreshold"> | ||
<integer>1000</integer> | ||
</element> | ||
</array> | ||
</arguments> | ||
</listener> | ||
<listener class="Symfony\Bridge\PhpUnit\SymfonyTestsListener"/> | ||
<listener class="MyBuilder\PhpunitAccelerator\TestListener"/> | ||
</listeners> | ||
</phpunit> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,39 +1,63 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
|
||
<!-- http://www.phpunit.de/manual/current/en/appendixes.configuration.html --> | ||
<!-- https://phpunit.de/manual/current/en/appendixes.configuration.html --> | ||
<phpunit | ||
backupGlobals = "false" | ||
backupStaticAttributes = "false" | ||
colors = "false" | ||
convertErrorsToExceptions = "true" | ||
convertNoticesToExceptions = "true" | ||
convertWarningsToExceptions = "true" | ||
processIsolation = "false" | ||
stopOnFailure = "false" | ||
syntaxCheck = "false" | ||
bootstrap = "tests/bootstrap.php" | ||
> | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/5.7/phpunit.xsd" | ||
backupGlobals="false" | ||
backupStaticAttributes="false" | ||
bootstrap="vendor/autoload.php" | ||
cacheTokens="true" | ||
stopOnError="false" | ||
stopOnFailure="false" | ||
stopOnWarning="false" | ||
stopOnIncomplete="false" | ||
stopOnRisky="false" | ||
stopOnSkipped="false" | ||
failOnRisky="false" | ||
failOnWarning="true" | ||
beStrictAboutChangesToGlobalState="false" | ||
beStrictAboutOutputDuringTests="false" | ||
beStrictAboutResourceUsageDuringSmallTests="false" | ||
beStrictAboutTestsThatDoNotTestAnything="false" | ||
beStrictAboutTodoAnnotatedTests="false" | ||
beStrictAboutCoversAnnotation="false" | ||
checkForUnintentionallyCoveredCode="false" | ||
enforceTimeLimit="false" | ||
verbose="false"> | ||
|
||
<testsuites> | ||
<testsuite name="Project Unit Tests"> | ||
<directory suffix="Test.php">src/Oro/Bundle/*Bundle/Tests/Unit</directory> | ||
<testsuite name="unit"> | ||
<directory>Tests/Unit</directory> | ||
<directory>src/*/Tests/Unit</directory> | ||
<directory>src/*/*/Tests/Unit</directory> | ||
<directory>src/*/*/*/Tests/Unit</directory> | ||
<directory>src/*/*/*/*/Tests/Unit</directory> | ||
<directory>src/*/*/*/*/*/Tests/Unit</directory> | ||
<directory>src/*/*/*/*/*/*/Tests/Unit</directory> | ||
<directory>src/*/*/*/*/*/*/*/Tests/Unit</directory> | ||
</testsuite> | ||
</testsuites> | ||
|
||
<!-- | ||
<php> | ||
<server name="KERNEL_DIR" value="/path/to/your/app/" /> | ||
<env name="SYMFONY_ENV" value="test"/> | ||
<env name="SYMFONY_DEBUG" value="0"/> | ||
<env name="SYMFONY_ENV" value="test"/> | ||
<env name="SYMFONY_DEPRECATIONS_HELPER" value="weak" /> | ||
<ini name="error_reporting" value="-1"/> | ||
<ini name="memory_limit" value="-1"/> | ||
</php> | ||
--> | ||
<filter> | ||
<whitelist> | ||
<directory>src</directory> | ||
<exclude> | ||
<directory>vendor</directory> | ||
<directory>src/Oro/Bundle/*Bundle/DataFixtures</directory> | ||
<directory>src/Oro/Bundle/*Bundle/Resources</directory> | ||
<directory>src/Oro/Bundle/*Bundle/Tests</directory> | ||
<directory>vendor</directory> | ||
</exclude> | ||
</whitelist> | ||
</filter> | ||
<listeners> | ||
<listener class="JohnKary\PHPUnit\Listener\SpeedTrapListener"> | ||
<arguments> | ||
<array> | ||
<element key="slowThreshold"> | ||
<integer>1000</integer> | ||
</element> | ||
</array> | ||
</arguments> | ||
</listener> | ||
<listener class="Symfony\Bridge\PhpUnit\SymfonyTestsListener"/> | ||
<listener class="MyBuilder\PhpunitAccelerator\TestListener"/> | ||
</listeners> | ||
</phpunit> |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.