Skip to content

Commit 795f09e

Browse files
committed
MQE-1884: MFTF - <after> failures override other failures
Added mapping to contexts for allure attachments.
1 parent d3e6a72 commit 795f09e

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

src/Magento/FunctionalTestingFramework/Extension/TestContextExtension.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,13 @@
1818
class TestContextExtension extends BaseExtension
1919
{
2020
const TEST_PHASE_AFTER = "_after";
21+
const TEST_PHASE_BEFORE = "_before";
22+
2123
const TEST_FAILED_FILE = 'failed';
24+
const TEST_HOOKS = [
25+
self::TEST_PHASE_AFTER => 'AfterHook',
26+
self::TEST_PHASE_BEFORE => 'BeforeHook'
27+
];
2228

2329
/**
2430
* Codeception Events Mapping to methods
@@ -127,6 +133,12 @@ public function attachExceptionToAllure($exception, $testMethod)
127133

128134
$context = $this->extractContext($trace, $testMethod);
129135

136+
if (isset(self::TEST_HOOKS[$context])) {
137+
$context = self::TEST_HOOKS[$context];
138+
} else {
139+
$context = 'TestMethod';
140+
}
141+
130142
AllureHelper::addAttachmentToCurrentStep($exception, $context . 'Exception');
131143

132144
//pop suppressed exceptions and attach to allure

0 commit comments

Comments
 (0)