Skip to content

Commit ae2fba1

Browse files
committed
MQE-1024: Refactor Algorithm For Mftf Build Groups
- fix review comments
1 parent 7525790 commit ae2fba1

File tree

2 files changed

+10
-8
lines changed

2 files changed

+10
-8
lines changed

src/Magento/FunctionalTestingFramework/Test/Objects/TestObject.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,13 @@
1515
*/
1616
class TestObject
1717
{
18+
const WAIT_TIME_ATTRIBUTE = 'time';
19+
1820
const TEST_ACTION_WEIGHT = [
1921
'waitForPageLoad' => 1500,
2022
'amOnPage' => 1000,
2123
'waitForLoadingMaskToDisappear' => 500,
22-
'wait' => 'time',
24+
'wait' => self::WAIT_TIME_ATTRIBUTE,
2325
'comment' => 5,
2426
'assertCount' => 5,
2527
'closeAdminNotification' => 10
@@ -208,7 +210,7 @@ private function calculateWeightedActionTimes($actions)
208210
/** @var ActionObject $action */
209211
if (array_key_exists($action->getType(), self::TEST_ACTION_WEIGHT)) {
210212
$weight = self::TEST_ACTION_WEIGHT[$action->getType()];
211-
if (is_string($weight) && $weight === 'time') {
213+
if ($weight === self::WAIT_TIME_ATTRIBUTE) {
212214
$weight = intval($action->getCustomActionAttributes()[$weight]) * 1000;
213215
}
214216

src/Magento/FunctionalTestingFramework/Util/Sorter/ParallelGroupSorter.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -237,24 +237,24 @@ private function getSuiteToSize($suiteNamesToTests)
237237
private function splitTestSuite($suiteName, $tests, $maxTime)
238238
{
239239
arsort($tests);
240-
$split_suites = [];
240+
$splitSuites = [];
241241
$availableTests = $tests;
242-
$split_count = 0;
242+
$splitCount = 0;
243243

244244
foreach ($tests as $test => $size) {
245245
if (!array_key_exists($test, $availableTests)) {
246246
continue;
247247
}
248248

249249
$group = $this->createTestGroup($maxTime, $test, $size, $availableTests);
250-
$split_suites["{$suiteName}_${split_count}"] = $group;
251-
$this->addSuiteToConfig($suiteName, "{$suiteName}_${split_count}", $group);
250+
$splitSuites["{$suiteName}_${splitCount}"] = $group;
251+
$this->addSuiteToConfig($suiteName, "{$suiteName}_${splitCount}", $group);
252252

253253
$availableTests = array_diff_key($availableTests, $group);
254-
$split_count++;
254+
$splitCount++;
255255
}
256256

257-
return $split_suites;
257+
return $splitSuites;
258258
}
259259

260260
/**

0 commit comments

Comments
 (0)