From 3804dddfddfbf76f2a43fec0d0c8de7f157893b9 Mon Sep 17 00:00:00 2001 From: Soumya Unnikrishnan Date: Thu, 21 May 2020 13:12:56 -0500 Subject: [PATCH 1/2] MQE-2138: Annotation static check incorrectly flags some extends tests for missing issueIds --- .../StaticCheck/AnnotationsCheck.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/Magento/FunctionalTestingFramework/StaticCheck/AnnotationsCheck.php b/src/Magento/FunctionalTestingFramework/StaticCheck/AnnotationsCheck.php index 86cbec2db..599e4766c 100644 --- a/src/Magento/FunctionalTestingFramework/StaticCheck/AnnotationsCheck.php +++ b/src/Magento/FunctionalTestingFramework/StaticCheck/AnnotationsCheck.php @@ -70,8 +70,11 @@ public function execute(InputInterface $input) $allTests = TestObjectHandler::getInstance(false)->getAllObjects(); foreach ($allTests as $test) { + if ($this->validateSkipIssueId($test)) { + //if test is skipped ignore other checks + continue; + } $this->validateRequiredAnnotations($test); - $this->validateSkipIssueId($test); $this->aggregateStoriesTitlePairs($test); $this->aggregateTestCaseIdTitlePairs($test); } @@ -150,19 +153,22 @@ private function validateRequiredAnnotations($test) * Validates that if the test is skipped, that it has an issueId value. * * @param TestObject $test - * @return void + * @return boolean */ private function validateSkipIssueId($test) { + $validateSkipped = false; $annotations = $test->getAnnotations(); $skip = $annotations['skip'] ?? null; if ($skip !== null) { + $validateSkipped = true; $issueId = $skip[0] ?? null; if ($issueId === null || strlen($issueId) == 0) { $this->errors[][] = "Test {$test->getName()} is skipped but the issueId is empty."; } } + return $validateSkipped; } /** From 283d63bafd6b037a6cf656531135f821e71481d7 Mon Sep 17 00:00:00 2001 From: Ji Lu Date: Fri, 22 May 2020 11:15:52 -0500 Subject: [PATCH 2/2] MQE-2138: annotation static check incorrectly flags some extends tests for missing issueIds --- .../StaticCheck/AnnotationsCheck.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Magento/FunctionalTestingFramework/StaticCheck/AnnotationsCheck.php b/src/Magento/FunctionalTestingFramework/StaticCheck/AnnotationsCheck.php index 599e4766c..6d415b52d 100644 --- a/src/Magento/FunctionalTestingFramework/StaticCheck/AnnotationsCheck.php +++ b/src/Magento/FunctionalTestingFramework/StaticCheck/AnnotationsCheck.php @@ -163,8 +163,8 @@ private function validateSkipIssueId($test) $skip = $annotations['skip'] ?? null; if ($skip !== null) { $validateSkipped = true; - $issueId = $skip[0] ?? null; - if ($issueId === null || strlen($issueId) == 0) { + if ((!isset($skip[0]) || strlen($skip[0]) == 0) + && (!isset($skip['issueId']) || strlen($skip['issueId']) == 0)) { $this->errors[][] = "Test {$test->getName()} is skipped but the issueId is empty."; } }