Skip to content

Commit 5eb4a9d

Browse files
committed
MQE-942: MFTF Annotation Static Check
1 parent d60de15 commit 5eb4a9d

File tree

2 files changed

+21
-0
lines changed

2 files changed

+21
-0
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,4 @@ dev/tests/mftf.log
1919
dev/tests/docs/*
2020
dev/tests/_output
2121
dev/tests/functional.suite.yml
22+
mftf-annotations-static-check.txt

src/Magento/FunctionalTestingFramework/StaticCheck/AnnotationsCheck.php

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ public function execute(InputInterface $input)
7171

7272
foreach ($allTests as $test) {
7373
$this->validateRequiredAnnotations($test);
74+
$this->validateSkipIssueId($test);
7475
$this->aggregateStoriesTitlePairs($test);
7576
$this->aggregateTestCaseIdTitlePairs($test);
7677
}
@@ -145,6 +146,25 @@ private function validateRequiredAnnotations($test)
145146
}
146147
}
147148

149+
/**
150+
* Validates that if the test is skipped, that it has an issueId value.
151+
*
152+
* @param TestObject $test
153+
* @return void
154+
*/
155+
private function validateSkipIssueId($test)
156+
{
157+
$annotations = $test->getAnnotations();
158+
159+
$skip = $annotations['skip'] ?? null;
160+
if ($skip !== null) {
161+
$issueId = $skip[0] ?? null;
162+
if ($issueId === null || strlen($issueId) == 0) {
163+
$this->errors[][] = "Test {$test->getName()} is skipped but the issueId is empty.";
164+
}
165+
}
166+
}
167+
148168
/**
149169
* Add the key = "stories appended to title", value = test name, to the class variable.
150170
*

0 commit comments

Comments
 (0)