Skip to content

MQE-783:Investigate allure reporting when tests run in multiple suites #87

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 9 commits into from
Apr 9, 2018
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
namespace Magento\FunctionalTestingFramework\Allure\Adapter;

use Magento\FunctionalTestingFramework\Data\Argument\Interpreter\NullType;
use Yandex\Allure\Adapter\AllureAdapter;
use Codeception\Event\SuiteEvent;

/**
* Class MagentoAllureAdapter
*
* Extends AllureAdapter to provide further information for allure reports
*
* @package Magento\FunctionalTestingFramework\Allure
*/

class MagentoAllureAdapter extends AllureAdapter
{
/**
* Array of group values passed to test runner command
*
* @return String
*/
private function getGroup()
{
if ($this->options['groups'] != null) {
return $this->options['groups'][0];
}
return null;
}

/**
* Override of parent method to set suitename as suitename and group name concatenated
*
* @param SuiteEvent $suiteEvent
* @return void
*/
public function suiteBefore(SuiteEvent $suiteEvent)
{
$changeSuiteEvent = $suiteEvent;

if ($this->getGroup() != null) {
$suite = $suiteEvent->getSuite();
$suiteName = ($suite->getName()) . "\\" . $this->getGroup();

call_user_func(\Closure::bind(
function () use ($suite, $suiteName) {
$suite->name = $suiteName;
},
null,
$suite
));

//change suiteEvent
$changeSuiteEvent = new SuiteEvent(
$suiteEvent->getSuite(),
$suiteEvent->getResult(),
$suiteEvent->getSettings()
);
}
// call parent function
parent::suiteBefore($changeSuiteEvent);
}
}