Skip to content

Commit a9f5bba

Browse files
committed
MQE-2008: Filter test generation and execution by severity
1 parent 7758075 commit a9f5bba

File tree

3 files changed

+15
-19
lines changed

3 files changed

+15
-19
lines changed

src/Magento/FunctionalTestingFramework/Filter/Test/Severity.php

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -11,20 +11,14 @@
1111
use Magento\FunctionalTestingFramework\Exceptions\TestFrameworkException;
1212
use Magento\FunctionalTestingFramework\Filter\FilterInterface;
1313
use Magento\FunctionalTestingFramework\Test\Objects\TestObject;
14+
use Magento\FunctionalTestingFramework\Test\Util\AnnotationExtractor;
1415

1516
/**
1617
* Class Severity
1718
*/
1819
class Severity implements FilterInterface
1920
{
2021
const ANNOTATION_TAG = 'severity';
21-
const SEVERITY_VALUES = [
22-
"BLOCKER",
23-
"CRITICAL",
24-
"MAJOR",
25-
"AVERAGE",
26-
"MINOR",
27-
];
2822

2923
/**
3024
* @var array
@@ -39,14 +33,18 @@ class Severity implements FilterInterface
3933
*/
4034
public function __construct(array $filterValues = [])
4135
{
42-
if (array_diff($filterValues, self::SEVERITY_VALUES) ==! []) {
43-
throw new TestFrameworkException(
44-
'Not existing severity specified.' . PHP_EOL
45-
. 'Possible values: '. implode(', ', self::SEVERITY_VALUES) . '.' . PHP_EOL
46-
. 'Provided values: ' . implode(', ', $filterValues) . '.' . PHP_EOL
47-
);
36+
$severityValues = AnnotationExtractor::MAGENTO_TO_ALLURE_SEVERITY_MAP;
37+
38+
foreach ($filterValues as $filterValue) {
39+
if (!isset($severityValues[$filterValue])) {
40+
throw new TestFrameworkException(
41+
'Not existing severity specified.' . PHP_EOL
42+
. 'Possible values: '. implode(', ', array_keys($severityValues)) . '.' . PHP_EOL
43+
. 'Provided values: ' . implode(', ', $filterValues) . '.' . PHP_EOL
44+
);
45+
}
46+
$this->filterValues[] = $severityValues[$filterValue];
4847
}
49-
$this->filterValues = $filterValues;
5048
}
5149

5250
/**

src/Magento/FunctionalTestingFramework/Suite/SuiteGenerator.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,9 @@ public function generateAllSuites($testManifest)
9797
foreach ($suites as $suiteName => $suiteContent) {
9898
if (empty($suiteContent)) {
9999
LoggingUtil::getInstance()->getLogger(self::class)->notification(
100-
"Suite '" . $suiteName . "' contains no tests and won't be generated." . PHP_EOL, [], true
100+
"Suite '" . $suiteName . "' contains no tests and won't be generated." . PHP_EOL,
101+
[],
102+
true
101103
);
102104
continue;
103105
}

src/Magento/FunctionalTestingFramework/Util/TestGenerator.php

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -172,9 +172,6 @@ private function loadAllTestObjects($testsToIgnore)
172172
{
173173
if ($this->tests === null || empty($this->tests)) {
174174
$testObjects = TestObjectHandler::getInstance()->getAllObjects();
175-
176-
177-
178175
return array_diff_key($testObjects, $testsToIgnore);
179176
}
180177

@@ -298,7 +295,6 @@ private function assembleAllTestPhp($testManifest, array $testsToIgnore)
298295
$filter->filter($testObjects);
299296
}
300297

301-
302298
foreach ($testObjects as $test) {
303299
// Do not generate test if it is an extended test and parent does not exist
304300
if ($test->isSkipped() && !empty($test->getParentName())) {

0 commit comments

Comments
 (0)