Skip to content

Commit 1062018

Browse files
committed
MQE-876: Add Skipped Tests in Allure Report
- TestObject now has getter for boolean for check if group annotation is skip - Test Generator generates skip code if the above getter returns true MQE-876: Add Skipped Tests in Allure Report - Fixed Static checks MQE-876: Add Skipped Tests in Allure Report - Refactored based on review MQE-876: Add Skipped Tests in Allure Report - Added newline to skip test generation to meet coding standards
1 parent 2fe0d2a commit 1062018

File tree

2 files changed

+22
-4
lines changed

2 files changed

+22
-4
lines changed

src/Magento/FunctionalTestingFramework/Test/Objects/TestObject.php

+13
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,19 @@ public function getFilename()
8888
return $this->filename;
8989
}
9090

91+
/**
92+
* Getter for the skip_test boolean
93+
*
94+
* @return string
95+
*/
96+
public function isSkipped()
97+
{
98+
if (array_key_exists('group', $this->annotations) && (in_array("skip", $this->annotations['group']))) {
99+
return true;
100+
}
101+
return false;
102+
}
103+
91104
/**
92105
* Getter for Codeception format name
93106
*

src/Magento/FunctionalTestingFramework/Util/TestGenerator.php

+9-4
Original file line numberDiff line numberDiff line change
@@ -1507,10 +1507,15 @@ private function generateTestPhp($test)
15071507
$testName = str_replace(' ', '', $testName);
15081508
$testAnnotations = $this->generateAnnotationsPhp($test->getAnnotations(), true);
15091509
$dependencies = 'AcceptanceTester $I';
1510-
try {
1511-
$steps = $this->generateStepsPhp($test->getOrderedActions());
1512-
} catch (TestReferenceException $e) {
1513-
throw new TestReferenceException($e->getMessage() . " in Test \"" . $test->getName() . "\"");
1510+
if ($test->isSkipped()) {
1511+
$steps = "\t\t" . '$scenario->skip("This test is skipped");' . "\n";
1512+
$dependencies .= ', \Codeception\Scenario $scenario';
1513+
} else {
1514+
try {
1515+
$steps = $this->generateStepsPhp($test->getOrderedActions());
1516+
} catch (TestReferenceException $e) {
1517+
throw new TestReferenceException($e->getMessage() . " in Test \"" . $test->getName() . "\"");
1518+
}
15141519
}
15151520

15161521
$testPhp .= $testAnnotations;

0 commit comments

Comments
 (0)