Parallel execution flow with the Functional Testing Framework
Parallel execution is applicable for test suites only. It decreases the time of testing due to distribution of test cases into multiple threads. A test case cannot be split between different threads. Parallel execution can use one or more copies of the Magento application under test (Magento instances).
A general mechanism is:
The FTF creates the list of all test cases in a test suite.
The FTF creates the required quantity of sessions corresponding to the quantity of threads defined in <magento2_root_dir>/dev/tests/functional/phpunit.xml.
The FTF distributes test cases between sessions. When a sessions is free, a new test case from the queue runs.
Comparatively to the common testing flow
you can run a test suite using parallel execution flow with one Magento instance
or run a test suite using parallel execution flow with multiple Magento instances.
Set up parallel execution
To set up a parallel execution flow, add Magento instances to <magento2_root_dir>/dev/tests/functional/phpunit.xml in the following format:
The default elements "app_frontend_url" and "app_backend_url" must be added obligatory. Otherwise FTF returns an error. The default instances are ignored if "app_instances" element is present.
Parallel execution flow with one Magento instance
Parallel execution flow with one Magento instance should be used with a caution. In this mode, test cases are executed simultaneously and can conflict with each other (for example, when different tests set the same parameter in different states).
Parallel execution flow with one Magento instance can cause conflict between tests running at the same time.
The following example shows a setup configuration of the flow with one Magento instance.
Parallel execution flow with multiple Magento instances
The following example shows a setup configuration of the flow with three Magento instances.
Run parallel execution flow
To run parallel execution flow, you must configure and run a test suite and corresponding Magento instances.