From 9e88feff93f6a125f840ad95000a31883277bde8 Mon Sep 17 00:00:00 2001 From: "g.dolgushin" Date: Tue, 1 Jun 2021 14:05:35 +0300 Subject: [PATCH 1/2] fix BuildTestName and add attachment in report for gherkin --- src/Yandex/Allure/Codeception/AllureCodeception.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/Yandex/Allure/Codeception/AllureCodeception.php b/src/Yandex/Allure/Codeception/AllureCodeception.php index 012f7da..4d57e07 100644 --- a/src/Yandex/Allure/Codeception/AllureCodeception.php +++ b/src/Yandex/Allure/Codeception/AllureCodeception.php @@ -252,7 +252,7 @@ private function buildTestName($test) { $testName .= ' with data set #' . $this->testInvocations[$testFullName]; } } else if($test instanceof Gherkin) { - $testName = $test->getMetadata()->getFeature(); + $testName = $test->getFeatureNode()->getTitle(); } return $testName; } @@ -394,6 +394,11 @@ public function testEnd(TestEvent $testEvent) foreach ($artifacts as $name => $artifact) { Allure::lifecycle()->fire(new AddAttachmentEvent($artifact, $name, null)); } + } elseif (version_compare(Codecept::VERSION, '3.0.0') > -1 && $testEvent->getTest() instanceof Gherkin) { + $artifacts = $testEvent->getTest()->getMetadata()->getReports(); + foreach ($artifacts as $name => $artifact) { + Allure::lifecycle()->fire(new AddAttachmentEvent($artifact, $name, null)); + } } $this->getLifecycle()->fire(new TestCaseFinishedEvent()); } From 48c86c98388a1280fddf9d2c7560f4a27d87e135 Mon Sep 17 00:00:00 2001 From: "g.dolgushin" Date: Thu, 3 Jun 2021 18:15:11 +0300 Subject: [PATCH 2/2] fix 2 buildTestName instead getFeatureNode to getScenarioNode --- src/Yandex/Allure/Codeception/AllureCodeception.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Yandex/Allure/Codeception/AllureCodeception.php b/src/Yandex/Allure/Codeception/AllureCodeception.php index 4d57e07..0c758c4 100644 --- a/src/Yandex/Allure/Codeception/AllureCodeception.php +++ b/src/Yandex/Allure/Codeception/AllureCodeception.php @@ -252,7 +252,7 @@ private function buildTestName($test) { $testName .= ' with data set #' . $this->testInvocations[$testFullName]; } } else if($test instanceof Gherkin) { - $testName = $test->getFeatureNode()->getTitle(); + $testName = $test->getScenarioNode()->getTitle(); } return $testName; }