From 0f2605eae6b573a48d5ba90d95f09a26fdfc372a Mon Sep 17 00:00:00 2001 From: Cliff Date: Wed, 5 Feb 2020 19:54:46 +0300 Subject: [PATCH 1/2] add missing codeception test check (via #51) --- 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 51a23a2..166824f 100644 --- a/src/Yandex/Allure/Codeception/AllureCodeception.php +++ b/src/Yandex/Allure/Codeception/AllureCodeception.php @@ -382,7 +382,7 @@ public function testSkipped(FailEvent $failEvent) public function testEnd(TestEvent $testEvent) { // attachments supported since Codeception 3.0 - if (version_compare(Codecept::VERSION, '3.0.0') > -1) { + if (version_compare(Codecept::VERSION, '3.0.0') > -1 && $testEvent->getTest() instanceof Cest) { $artifacts = $testEvent->getTest()->getMetadata()->getReports(); $testCaseStorage = $this->getLifecycle()->getTestCaseStorage()->get(); foreach ($artifacts as $name => $artifact) { From 67eddabc9832186d2fc949bb854909fc2e773e44 Mon Sep 17 00:00:00 2001 From: Dmitry Baev Date: Wed, 5 Feb 2020 19:55:24 +0300 Subject: [PATCH 2/2] add method info labels to cest tests (via #52) --- composer.json | 4 ++-- src/Yandex/Allure/Codeception/AllureCodeception.php | 5 +++++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/composer.json b/composer.json index d4ef8bb..81c73d7 100644 --- a/composer.json +++ b/composer.json @@ -16,9 +16,9 @@ "source": "https://github.com/allure-framework/allure-codeception" }, "require": { - "php": ">=5.4.0", + "php": ">=5.6", "codeception/codeception": "^2.3|^3.0", - "allure-framework/allure-php-api": "~1.1.0", + "allure-framework/allure-php-api": "~1.1.7", "symfony/filesystem": ">=2.6", "symfony/finder": ">=2.6" }, diff --git a/src/Yandex/Allure/Codeception/AllureCodeception.php b/src/Yandex/Allure/Codeception/AllureCodeception.php index 166824f..0edbca5 100644 --- a/src/Yandex/Allure/Codeception/AllureCodeception.php +++ b/src/Yandex/Allure/Codeception/AllureCodeception.php @@ -261,7 +261,12 @@ public function testStart(TestEvent $testEvent) $testName = $this->buildTestName($test); $event = new TestCaseStartedEvent($this->uuid, $testName); if ($test instanceof Cest) { + $methodName = $test->getName(); $className = get_class($test->getTestClass()); + $event->setLabels(array_merge($event->getLabels(), [ + new Label("testMethod", $methodName), + new Label("testClass", $className) + ])); $annotations = []; if (class_exists($className, false)) { $annotations = array_merge($annotations, Annotation\AnnotationProvider::getClassAnnotations($className));