Skip to content

Commit e1af7cf

Browse files
authored
Merge pull request #307 from magento-gl/4.3.2-Release-Checklist
4.3.2 release checklist : MFTF Release Checklist
2 parents 4b4214e + 10a03d5 commit e1af7cf

File tree

6 files changed

+85
-3
lines changed

6 files changed

+85
-3
lines changed

CHANGELOG.md

+9
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,15 @@
11
Magento Functional Testing Framework Changelog
22
================================================
33

4+
4.3.2
5+
---------
6+
### Enhancements
7+
* 'bootstrap' argument added to indicate that no additional background processes will be run and the jobs complete in the foreground process.
8+
9+
### Fixes
10+
* Fixed serialization of weakmap exception thrown for every internal exception after codeception upgrade.
11+
* Fixed suites no longer separated by MFTF Suite.
12+
413
4.3.1
514
---------
615
### Fixes

composer.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "magento/magento2-functional-testing-framework",
33
"description": "Magento2 Functional Testing Framework",
44
"type": "library",
5-
"version": "4.3.1",
5+
"version": "4.3.2",
66
"license": "AGPL-3.0",
77
"keywords": ["magento", "automation", "functional", "testing"],
88
"config": {

composer.lock

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/Magento/FunctionalTestingFramework/Allure/AllureHelper.php

+5-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,11 @@ class AllureHelper
2323
public static function addAttachmentToCurrentStep($data, $caption): void
2424
{
2525
if (!is_string($data)) {
26-
$data = serialize($data);
26+
try {
27+
$data = serialize($data);
28+
} catch (\Exception $exception) {
29+
throw new \Exception($data->getMessage());
30+
}
2731
}
2832
if (@file_exists($data) && is_file($data)) {
2933
Allure::attachmentFile($caption, $data);

src/Magento/FunctionalTestingFramework/Extension/TestContextExtension.php

+65
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,13 @@
88

99
use Codeception\Events;
1010
use Codeception\Step;
11+
use Codeception\Test\Test;
1112
use Magento\FunctionalTestingFramework\Allure\AllureHelper;
1213
use Magento\FunctionalTestingFramework\DataGenerator\Handlers\PersistedObjectHandler;
14+
use Magento\FunctionalTestingFramework\Suite\Handlers\SuiteObjectHandler;
1315
use Magento\FunctionalTestingFramework\Util\Logger\LoggingUtil;
1416
use Qameta\Allure\Allure;
17+
use Qameta\Allure\AllureLifecycleInterface;
1518
use Qameta\Allure\Model\StepResult;
1619
use Magento\FunctionalTestingFramework\Test\Objects\ActionObject;
1720
use Magento\FunctionalTestingFramework\Test\Objects\ActionGroupObject;
@@ -158,6 +161,68 @@ function (TestResult $testResult) {
158161
$this->getFormattedSteps($testResult);
159162
}
160163
);
164+
165+
$this->addTestsInSuites($lifecycle, $cest);
166+
}
167+
168+
/**
169+
* Function to add test under the suites.
170+
*
171+
* @param object $lifecycle
172+
* @param object $cest
173+
*
174+
* @return void
175+
*/
176+
private function addTestsInSuites($lifecycle, $cest): void
177+
{
178+
$groupName = null;
179+
if ($this->options['groups'] !== null) {
180+
$group = $this->options['groups'][0];
181+
$groupName = $this->sanitizeGroupName($group);
182+
}
183+
$lifecycle->updateTest(
184+
function (TestResult $testResult) use ($groupName, $cest) {
185+
$labels = $testResult->getLabels();
186+
foreach ($labels as $label) {
187+
if ($groupName !== null && $label->getName() === "parentSuite") {
188+
$label->setValue(sprintf('%s\%s', $label->getValue(), $groupName));
189+
}
190+
if ($label->getName() === "package") {
191+
$className = $cest->getReportFields()['class'];
192+
$className = preg_replace('{_[0-9]*_G}', '', $className);
193+
$label->setValue($className);
194+
}
195+
}
196+
}
197+
);
198+
}
199+
200+
/**
201+
* Function which santizes any group names changed by the framework for execution in order to consolidate reporting.
202+
*
203+
* @param string $group
204+
* @return string
205+
*/
206+
private function sanitizeGroupName($group): string
207+
{
208+
$suiteNames = array_keys(SuiteObjectHandler::getInstance()->getAllObjects());
209+
$exactMatch = in_array($group, $suiteNames);
210+
211+
// if this is an existing suite name we dont' need to worry about changing it
212+
if ($exactMatch || strpos($group, "_") === false) {
213+
return $group;
214+
}
215+
216+
// if we can't find this group in the generated suites we have to assume that the group was split for generation
217+
$groupNameSplit = explode("_", $group);
218+
array_pop($groupNameSplit);
219+
array_pop($groupNameSplit);
220+
$originalName = implode("_", $groupNameSplit);
221+
222+
// confirm our original name is one of the existing suite names otherwise just return the original group name
223+
$originalName = in_array($originalName, $suiteNames) ? $originalName : $group;
224+
225+
return $originalName;
161226
}
162227

163228
/**

src/Magento/FunctionalTestingFramework/Module/MagentoWebDriver.php

+4
Original file line numberDiff line numberDiff line change
@@ -1033,6 +1033,10 @@ private function executeCronjobs($cronGroups, $timeout, $arguments): string
10331033
{
10341034
$cronGroups = array_filter($cronGroups);
10351035

1036+
if (isset($cronGroups[0]) && !isset($cronGroups[1])) {
1037+
$arguments .= ' --bootstrap=standaloneProcessStarted=1';
1038+
}
1039+
10361040
$waitFor = $this->getCronWait($cronGroups);
10371041

10381042
if ($waitFor) {

0 commit comments

Comments
 (0)