Skip to content

Commit

Permalink
Merge pull request #307 from magento-gl/4.3.2-Release-Checklist
Browse files Browse the repository at this point in the history
4.3.2 release checklist : MFTF Release Checklist
  • Loading branch information
jilu1 authored Jun 19, 2023
2 parents 4b4214e + 10a03d5 commit e1af7cf
Show file tree
Hide file tree
Showing 6 changed files with 85 additions and 3 deletions.
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
Magento Functional Testing Framework Changelog
================================================

4.3.2
---------
### Enhancements
* 'bootstrap' argument added to indicate that no additional background processes will be run and the jobs complete in the foreground process.

### Fixes
* Fixed serialization of weakmap exception thrown for every internal exception after codeception upgrade.
* Fixed suites no longer separated by MFTF Suite.

4.3.1
---------
### Fixes
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "magento/magento2-functional-testing-framework",
"description": "Magento2 Functional Testing Framework",
"type": "library",
"version": "4.3.1",
"version": "4.3.2",
"license": "AGPL-3.0",
"keywords": ["magento", "automation", "functional", "testing"],
"config": {
Expand Down
2 changes: 1 addition & 1 deletion composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,11 @@ class AllureHelper
public static function addAttachmentToCurrentStep($data, $caption): void
{
if (!is_string($data)) {
$data = serialize($data);
try {
$data = serialize($data);
} catch (\Exception $exception) {
throw new \Exception($data->getMessage());
}
}
if (@file_exists($data) && is_file($data)) {
Allure::attachmentFile($caption, $data);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,13 @@

use Codeception\Events;
use Codeception\Step;
use Codeception\Test\Test;
use Magento\FunctionalTestingFramework\Allure\AllureHelper;
use Magento\FunctionalTestingFramework\DataGenerator\Handlers\PersistedObjectHandler;
use Magento\FunctionalTestingFramework\Suite\Handlers\SuiteObjectHandler;
use Magento\FunctionalTestingFramework\Util\Logger\LoggingUtil;
use Qameta\Allure\Allure;
use Qameta\Allure\AllureLifecycleInterface;
use Qameta\Allure\Model\StepResult;
use Magento\FunctionalTestingFramework\Test\Objects\ActionObject;
use Magento\FunctionalTestingFramework\Test\Objects\ActionGroupObject;
Expand Down Expand Up @@ -158,6 +161,68 @@ function (TestResult $testResult) {
$this->getFormattedSteps($testResult);
}
);

$this->addTestsInSuites($lifecycle, $cest);
}

/**
* Function to add test under the suites.
*
* @param object $lifecycle
* @param object $cest
*
* @return void
*/
private function addTestsInSuites($lifecycle, $cest): void
{
$groupName = null;
if ($this->options['groups'] !== null) {
$group = $this->options['groups'][0];
$groupName = $this->sanitizeGroupName($group);
}
$lifecycle->updateTest(
function (TestResult $testResult) use ($groupName, $cest) {
$labels = $testResult->getLabels();
foreach ($labels as $label) {
if ($groupName !== null && $label->getName() === "parentSuite") {
$label->setValue(sprintf('%s\%s', $label->getValue(), $groupName));
}
if ($label->getName() === "package") {
$className = $cest->getReportFields()['class'];
$className = preg_replace('{_[0-9]*_G}', '', $className);
$label->setValue($className);
}
}
}
);
}

/**
* Function which santizes any group names changed by the framework for execution in order to consolidate reporting.
*
* @param string $group
* @return string
*/
private function sanitizeGroupName($group): string
{
$suiteNames = array_keys(SuiteObjectHandler::getInstance()->getAllObjects());
$exactMatch = in_array($group, $suiteNames);

// if this is an existing suite name we dont' need to worry about changing it
if ($exactMatch || strpos($group, "_") === false) {
return $group;
}

// if we can't find this group in the generated suites we have to assume that the group was split for generation
$groupNameSplit = explode("_", $group);
array_pop($groupNameSplit);
array_pop($groupNameSplit);
$originalName = implode("_", $groupNameSplit);

// confirm our original name is one of the existing suite names otherwise just return the original group name
$originalName = in_array($originalName, $suiteNames) ? $originalName : $group;

return $originalName;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1033,6 +1033,10 @@ private function executeCronjobs($cronGroups, $timeout, $arguments): string
{
$cronGroups = array_filter($cronGroups);

if (isset($cronGroups[0]) && !isset($cronGroups[1])) {
$arguments .= ' --bootstrap=standaloneProcessStarted=1';
}

$waitFor = $this->getCronWait($cronGroups);

if ($waitFor) {
Expand Down

0 comments on commit e1af7cf

Please sign in to comment.