Download the PHP package reach-digital/magento2-test-framework without Composer

On this page you can find all versions of the php package reach-digital/magento2-test-framework. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package magento2-test-framework

ReachDigital Magento 2 Performance tuned integration tests

Installation

Usage

After the installation of the package there will be a folder dev/tests/quick-integration with the new integration test framework. Copy phpunit.xml.dist to phpunit.xml and make your changes to include your own namespaces.

Test Execution

To get the fastest result, execute the quick integration with plain phpunit like so:

A more convenient, but slower execution can be done via bin/magento itself. Make sure, you add the -c option to in order to apply to correct configuration.

TestModule

Automatically installs test modules that are available in the following path: vendor/*/*/TestModule/*/* so for example vendor/reach-digital/magento2-order-source-reservations/TestModule/Magento/TestModuleInventoryStateCache.

Goals

Non-Goals

Motivation

Magento 2's integration tests are notoriously slow in booting up, which makes practicing TDD a pain in the ass. Nobody wants to wait more than 10 seconds for tests to start..

Speed matters, but Magento developer have grown accustomed that things are just slow.

  • 0 to 100ms: Respond to user actions within this time window and users feel like the result is immediate. Any longer, and the connection between action and reaction is broken.
  • 100 to 300ms: Users experience a slight perceptible delay.
  • 300 to 1000ms: Within this window, things feel part of a natural and continuous progression of tasks. For most users on the web, loading pages or changing views represents a task.
  • 1000ms or more: Beyond 1000 milliseconds (1 second), users lose focus on the task they are performing.
  • 10000ms or more: Beyond 10000 milliseconds (10 seconds), users are frustrated and are likely to abandon tasks. They may or may not come back later.

https://developers.google.com/web/fundamentals/performance/rail

Currently it is no exception for the integration tests to run more than 10000ms: "Developers get frustrated, are likely to abandon the test. They may or may not try TDD again later."

To put it in perspective: It is faster to load an Admin Page, click a button there than it is to click Play on a test.. it should not be this way.

Because: If Magento is able to render a complete html-page under 200ms, shouldn't a test be able to start at least as quickly as well?

Performance improvements

So the idea is that Magento is probably cleaning a lof of cache while booting up, running additional tests, etc. If we can prevent the cleaning of cache, state, etc. we can achieve much higher performance and maybe even surpass the frontend.

Although this is probably a good idea to have 'clean slate', it isn't even a great idea per sé. Code should be resiliant and should be able to run with warmed cache and cold cache..

1. Disable memory cleanup scripts

Speed improvement; ~10-20s

By disabling the following classes we get the biggest speed improvement.

2. Fix overzealous app reinitialisation

Speed improvement; ~50ms

3. Disable config-global.php by default

Speed improvement; ~280ms

The config-global.php.dist will always set some config values, but this requires reinitialisation of the config. By not using this functionality we shave another 300ms off the request.

4. Disabled sequence table generation

Speed improvement; ~400ms

By default Magento creates all sequence tables

Quality of life improvements

1. Moved the generation folder back to the root

Usually an IDE doesn't like it when duplicate classes exist, because of this reason the dev/test/integration/tmp/sandbox-* directory should be ignored. By moving the generated folder to the root of the project we get the benefit that the IDE can inspect those classes.

2. Disable modules while running tests, copies app/etc/config.php

Question asked here:


All versions of magento2-test-framework with dependencies

PHP Build Version
Package Version
Requires magento/framework Version ~100.1.0||~101.0.0||~102.0.0||~103.0.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package reach-digital/magento2-test-framework contains the following files

Loading the files please wait ....