MediaWiki master
MediaWiki\Composer\PhpUnitSplitter\TestSuiteBuilder Class Reference

Public Member Functions

 buildSuites (array $testDescriptors, int $groups, ?int $chunkSize=null)
 Try to build balanced groups (split_groups) of tests.
 

Detailed Description

Note
GPL-2.0-or-later

Definition at line 10 of file TestSuiteBuilder.php.

Member Function Documentation

◆ buildSuites()

MediaWiki\Composer\PhpUnitSplitter\TestSuiteBuilder::buildSuites ( array $testDescriptors,
int $groups,
?int $chunkSize = null )

Try to build balanced groups (split_groups) of tests.

We have a couple of objectives here:

  • the groups should contain a stable ordering of tests so that we reduce the amount of random test failures due to test re-ordering
  • the groups should reduce the number of interacting extensions where possible. This is achieved with the alphabetical sort on filename - tests of the same extension will be grouped together
  • the groups should have a similar test execution time

Information about test duration may be completely absent (if no test cache information is supplied), or partially absent (if the test has not been seen before). We attempt to create similar-duration split-groups using the information we have available, and if anything goes wrong we fall back to just creating split-groups with the same number of tests in them.

Parameters
array$testDescriptorsthe list of tests that we want to sort into split_groups
int$groupsthe number of split_groups we are targetting
?int$chunkSizeoptionally override the size of the 'chunks' into which tests are grouped. If not supplied, the chunk size will depend on the total number of tests.
Returns
array a structured array of the resulting split_groups

Definition at line 38 of file TestSuiteBuilder.php.


The documentation for this class was generated from the following file: