{"id":15014471,"url":"https://github.com/ho-nl/magento2-reachdigital_testframework","last_synced_at":"2025-10-05T12:29:44.025Z","repository":{"id":33810672,"uuid":"155979365","full_name":"ho-nl/magento2-ReachDigital_TestFramework","owner":"ho-nl","description":"Faster drop-in replacement for Magento's integration test.","archived":false,"fork":false,"pushed_at":"2024-09-19T14:43:36.000Z","size":66,"stargazers_count":76,"open_issues_count":7,"forks_count":12,"subscribers_count":11,"default_branch":"master","last_synced_at":"2025-09-07T04:30:05.768Z","etag":null,"topics":["magento2","magento2-module","phpunit"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ho-nl.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-11-03T12:06:34.000Z","updated_at":"2024-09-25T13:42:26.000Z","dependencies_parsed_at":"2022-08-07T23:15:20.541Z","dependency_job_id":"07efd931-d11f-48f9-8499-e76492c88d3d","html_url":"https://github.com/ho-nl/magento2-ReachDigital_TestFramework","commit_stats":{"total_commits":43,"total_committers":11,"mean_commits":3.909090909090909,"dds":0.5813953488372092,"last_synced_commit":"0ca693e2235745837588cf2f0807229334d6e4a4"},"previous_names":[],"tags_count":11,"template":false,"template_full_name":null,"purl":"pkg:github/ho-nl/magento2-ReachDigital_TestFramework","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ho-nl%2Fmagento2-ReachDigital_TestFramework","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ho-nl%2Fmagento2-ReachDigital_TestFramework/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ho-nl%2Fmagento2-ReachDigital_TestFramework/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ho-nl%2Fmagento2-ReachDigital_TestFramework/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ho-nl","download_url":"https://codeload.github.com/ho-nl/magento2-ReachDigital_TestFramework/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ho-nl%2Fmagento2-ReachDigital_TestFramework/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278456634,"owners_count":25989948,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-05T02:00:06.059Z","response_time":54,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["magento2","magento2-module","phpunit"],"created_at":"2024-09-24T19:45:40.343Z","updated_at":"2025-10-05T12:29:44.002Z","avatar_url":"https://github.com/ho-nl.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ReachDigital Magento 2 Performance tuned integration tests\n\n- Boots up the integration test framework in less than 300ms when caches are\n  primed.\n- Adds the ability to automatically install TestModules.\n\n## Installation\n\n```bash\ncomposer require --dev reach-digital/magento2-test-framework\n```\n\n## Usage\n\nAfter the installation of the package there will be a folder\n`dev/tests/quick-integration` with the new integration test framework. Copy\n`phpunit.xml.dist` to `phpunit.xml` and make your changes to include your own\nnamespaces.\n\n## Test Execution\n\nTo get the fastest result, execute the quick integration with plain `phpunit`\nlike so:\n\n```bash\n# Running Quick integration tests via phpunit\ncd dev/tests/integration\nphp ../../../vendor/bin/phpunit -c ../quick-integration/phpunit.xml\n```\n\nA more convenient, but slower execution can be done via `bin/magento` itself.\nMake sure, you add the `-c` option to in order to apply to correct\nconfiguration.\n\n```bash\n# Running Quick integration tests via bin/magento\nphp bin/magento dev:tests:run integration -c $(pwd)/dev/tests/quick-integration/phpunit.xml\n```\n\n### TestModule\n\nAutomatically installs test modules that are available in the following path:\n`vendor/*/*/TestModule/*/*` so for example\n`vendor/reach-digital/magento2-order-source-reservations/TestModule/Magento/TestModuleInventoryStateCache`.\n\n## Goals\n\n- Have the startup time of the integration test framework below 300ms.\n- Have no feature regressions for small batches of test.\n- Show helpful messages to speed up your tests\n\n## Non-Goals\n\n- Be a complete replacement for the complete integration test suite, only\n  support the small suite that you test locally will be fine.\n\n## Motivation\n\nMagento 2's integration tests are notoriously slow in booting up, which makes\npracticing TDD a pain in the ass. Nobody wants to wait more than 10 seconds for\ntests to start..\n\nSpeed matters, but Magento developer have grown accustomed that things are just\nslow.\n\n\u003e - 0 to 100ms: Respond to user actions within this time window and users feel\n\u003e   like the result is immediate. Any longer, and the connection between action\n\u003e   and reaction is broken.\n\u003e - 100 to 300ms: Users experience a slight perceptible delay.\n\u003e - 300 to 1000ms: Within this window, things feel part of a natural and\n\u003e   continuous progression of tasks. For most users on the web, loading pages or\n\u003e   changing views represents a task.\n\u003e - 1000ms or more: Beyond 1000 milliseconds (1 second), users lose focus on the\n\u003e   task they are performing.\n\u003e - 10000ms or more: Beyond 10000 milliseconds (10 seconds), users are\n\u003e   frustrated and are likely to abandon tasks. They may or may not come back\n\u003e   later.\n\u003e\n\u003e https://developers.google.com/web/fundamentals/performance/rail\n\nCurrently it is no exception for the integration tests to run more than 10000ms:\n\"Developers get frustrated, are likely to abandon the test. They may or may not\ntry TDD again later.\"\n\nTo put it in perspective: It is faster to load an Admin Page, click a button\nthere than it is to click Play on a test.. it should not be this way.\n\nBecause: **If Magento is able to render a complete html-page under 200ms,\nshouldn't a test be able to start at least as quickly as well?**\n\n## Performance improvements\n\nSo the idea is that Magento is probably cleaning a lof of cache while booting\nup, running additional tests, etc. If we can prevent the cleaning of cache,\nstate, etc. we can achieve much higher performance and maybe even surpass the\nfrontend.\n\n_Although this is probably a good idea to have 'clean slate', it isn't even a\ngreat idea per sé. Code should be resiliant and should be able to run with\nwarmed cache and cold cache.._\n\n### 1. Disable memory cleanup scripts\n\nSpeed improvement; ~10-20s\n\nBy disabling the following classes we get the biggest speed improvement.\n\n```php\n\u003c?php declare(strict_types=1);\n\\Magento\\TestFramework\\Workaround\\Cleanup\\TestCaseProperties::class;\n\\Magento\\TestFramework\\Workaround\\Cleanup\\StaticProperties::class;\n```\n\n### 2. Fix overzealous app reinitialisation\n\nSpeed improvement; ~50ms\n\n```php\n\u003c?php declare(strict_types=1);\n//Rewrites Magento's AppIsolation class\n\\ReachDigital\\TestFramework\\Annotation\\AppIsolation::class;\n```\n\n### 3. Disable config-global.php by default\n\nSpeed improvement; ~280ms\n\nThe config-global.php.dist will always set some config values, but this requires\nreinitialisation of the config. By not using this functionality we shave another\n300ms off the request.\n\n### 4. Disabled sequence table generation\n\nSpeed improvement; ~400ms\n\nBy default Magento creates all sequence tables\n\n## Quality of life improvements\n\n### 1. Moved the generation folder back to the root\n\nUsually an IDE doesn't like it when duplicate classes exist, because of this\nreason the `dev/test/integration/tmp/sandbox-*` directory should be ignored. By\nmoving the generated folder to the root of the project we get the benefit that\nthe IDE can inspect those classes.\n\n### 2. Disable modules while running tests, copies `app/etc/config.php`\n\nQuestion asked here:\n\n- [magento.stackexchange.com: Disable module in integration tests](https://magento.stackexchange.com/questions/221736/disable-module-in-integration-tests-how-is-the-sandbox-config-php-written)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fho-nl%2Fmagento2-reachdigital_testframework","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fho-nl%2Fmagento2-reachdigital_testframework","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fho-nl%2Fmagento2-reachdigital_testframework/lists"}