GithubHelp home page GithubHelp logo

allure-framework / allure-codeception Goto Github PK

View Code? Open in Web Editor NEW
49.0 12.0 41.0 131 KB

Codeception framework adapter for Allure

License: Apache License 2.0

PHP 99.17% Gherkin 0.83%
codeception allure reporting

allure-codeception's People

Contributors

alnivv-vi avatar atcliffunderline avatar baev avatar davertmik avatar dependabot[bot] avatar dolgushing avatar eroshenkoam avatar esteban-serfe avatar etki avatar ivan1986 avatar kouratoras avatar mitrichius avatar nicholascus avatar nixdrey avatar okolesnyk avatar pablopaul avatar remorhaz avatar robot-bucket avatar scaytrase avatar thespecial avatar vania-pooh avatar vromants avatar vsugak avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

allure-codeception's Issues

Do not display parameters inside the steps

Describe the bug
In the first version of the Allure PHP adapter, the display of steps was implemented differently. However, in the new version of the PHP adapter, there are no substeps as such. Instead, only function parameters are displayed in steps in the Allure report.

To Reproduce
Steps to reproduce the behavior:

  1. Create a function with Allure::runStep() function
  2. Create a sub function in the same method
  3. Upload to allure and open steps

Expected behavior
There are no parameters inside the steps

Screenshots
Screenshot 2023-05-05 at 5 05 08 PM

Screenshot 2023-05-05 at 5 05 34 PM

Devices
Doesn't matter

Additional context
See test example

Empty fullName field in allure reports

Describe the bug
Field fullName is empty in allure report and it's difficult to search tests

To Reproduce
Steps to reproduce the behavior:

  1. Run some codeception cest
  2. Check *-result.json file in allure-results/ directory

Expected behavior
Field fullName equals to Fully qualified method name such as \Foo\Bar::fooBar

Screenshots
image
image

Desktop (please complete the following information):

  • OS: Linux

Codeception allure adapter conflicting with PHPUnit allure adapter

Problem

If any project will require two allure-framework packages (in our case allure-phpunit and allure-codeception) we will have two classes which have identical full class names: Yandex\Allure\Adapter\AllureAdapter.
It will cause an issue for autoloader to load appropriate adaptor for codeception and phpunit.

Suggestion

Make namespace unique.
For example:
Yandex\Allure\Codeception\Adapter\AllureAdapter
Yandex\Allure\PHPUnit\Adapter\AllureAdapter

Or class name unique

Yandex\Allure\Adapter\CodeceptionAllureAdapter
Yandex\Allure\Adapter\PHPUnitAllureAdapter

Related Issue

allure-framework/allure-phpunit#41

New Version Not Released

It seems the auto-update on packagist not working.
I can't see 1.4.0 there but the tag is already there.
Please check that packagist can handle updates! Thanks @baev

"codecept console suitename" does not work

Interactive console started for suite acceptance
Try Codeception commands without writing a test
type 'exit' to leave console
type 'actions' to see all available actions for this suite

[PHPUnit_Framework_Exception]
file_get_contents(): Filename cannot be empty

Tests work well. Console does not work with allure extension.

The annotation "@JMS\Serializer\Annotation\XmlNamespace" in class Yandex\Allure\Adapter\Model\TestSuite does not exist, or could not be auto-loaded.

Hi,
After a successfully executed test ("./vendor/bin/codecept" run acceptance "myTestCept.php" --debug -vvv I get the following error

[Doctrine\Common\Annotations\AnnotationException]
 [Semantical Error] The annotation "@JMS\Serializer\Annotation\XmlNamespace" in class Yandex\Allure\Adapter\Model\TestSuite does not exist, or could not be auto-loaded.

Exception trace:
 () at %replaced-path%codeception_composer\vendor\doctrine\annotations\lib\Doctrine\Common\Annotations\AnnotationException.php:54
 Doctrine\Common\Annotations\AnnotationException::semanticalError() at %replaced-path%codeception_composer\vendor\doctrine\annotations\lib\Doctrine\Common\Annotations\DocParser.php:706
 Doctrine\Common\Annotations\DocParser->Annotation() at %replaced-path%codeception_composer\vendor\doctrine\annotations\lib\Doctrine\Common\Annotations\DocParser.php:639
 Doctrine\Common\Annotations\DocParser->Annotations() at %replaced-path%codeception_composer\vendor\doctrine\annotations\lib\Doctrine\Common\Annotations\DocParser.php:334
 Doctrine\Common\Annotations\DocParser->parse() at %replaced-path%codeception_composer\vendor\doctrine\annotations\lib\Doctrine\Common\Annotations\AnnotationReader.php:185
 Doctrine\Common\Annotations\AnnotationReader->getClassAnnotations() at %replaced-path%codeception_composer\vendor\jms\serializer\src\JMS\Serializer\Metadata\Driver\AnnotationDriver.php:8
 JMS\Serializer\Metadata\Driver\AnnotationDriver->loadMetadataForClass() at %replaced-path%codeception_composer\vendor\jms\metadata\src\Metadata\MetadataFactory.php:103
 Metadata\MetadataFactory->getMetadataForClass() at %replaced-path%codeception_composer\vendor\jms\serializer\src\JMS\Serializer\GraphNavigator.php:180
 JMS\Serializer\GraphNavigator->accept() at %replaced-path%codeception_composer\vendor\jms\serializer\src\JMS\Serializer\Serializer.php:91
 JMS\Serializer\Serializer->serialize() at %replaced-path%codeception_composer\vendor\allure-framework\allure-php-api\src\Yandex\Allure\Adapter\Model\TestSuite.php:223
 Yandex\Allure\Adapter\Model\TestSuite->serialize() at %replaced-path%codeception_composer\vendor\allure-framework\allure-php-api\src\Yandex\Allure\Adapter\Allure.php:168
 Yandex\Allure\Adapter\Allure->saveToFile() at %replaced-path%codeception_composer\vendor\allure-framework\allure-php-api\src\Yandex\Allure\Adapter\Allure.php:162
 Yandex\Allure\Adapter\Allure->processTestSuiteFinishedEvent() at %replaced-path%codeception_composer\vendor\allure-framework\allure-php-api\src\Yandex\Allure\Adapter\Allure.php:82
 Yandex\Allure\Adapter\Allure->fire() at %replaced-path%codeception_composer\vendor\allure-framework\allure-codeception\src\Yandex\Allure\Adapter\AllureAdapter.php:92
 Yandex\Allure\Adapter\AllureAdapter->suiteAfter() at n/a:n/a
 call_user_func() at %replaced-path%codeception_composer\vendor\symfony\event-dispatcher\Symfony\Component\EventDispatcher\EventDispatcher.php:164
 Symfony\Component\EventDispatcher\EventDispatcher->doDispatch() at %replaced-path%codeception_composer\vendor\symfony\event-dispatcher\Symfony\Component\EventDispatcher\EventDispatcher.p
 Symfony\Component\EventDispatcher\EventDispatcher->dispatch() at %replaced-path%codeception_composer\vendor\codeception\codeception\src\Codeception\SuiteManager.php:154
 Codeception\SuiteManager->run() at %replaced-path%codeception_composer\vendor\codeception\codeception\src\Codeception\Codecept.php:172
 Codeception\Codecept->runSuite() at %replaced-path%codeception_composer\vendor\codeception\codeception\src\Codeception\Codecept.php:155
 Codeception\Codecept->run() at %replaced-path%codeception_composer\vendor\codeception\codeception\src\Codeception\Command\Run.php:143
 Codeception\Command\Run->execute() at %replaced-path%codeception_composer\vendor\symfony\console\Symfony\Component\Console\Command\Command.php:252
 Symfony\Component\Console\Command\Command->run() at %replaced-path%codeception_composer\vendor\symfony\console\Symfony\Component\Console\Application.php:887
 Symfony\Component\Console\Application->doRunCommand() at %replaced-path%codeception_composer\vendor\symfony\console\Symfony\Component\Console\Application.php:193
 Symfony\Component\Console\Application->doRun() at %replaced-path%codeception_composer\vendor\symfony\console\Symfony\Component\Console\Application.php:124
 Symfony\Component\Console\Application->run() at %replaced-path%codeception_composer\vendor\codeception\codeception\codecept:27

Codeception version is 2.0.0

"./vendor/bin/codecept" --v
Codeception version 2.0.0

codeception.yml includes

extensions:
    enabled: [Yandex\Allure\Adapter\AllureAdapter]

and in composer.json I have

{
    "require": {
        "codeception/codeception": "2.0.0",
        "php": ">=5.4.0",
        "allure-framework/allure-codeception": "~1.0.0"
    }
}

composer update says

composer update
Loading composer repositories with package information
Updating dependencies (including require-dev)
Nothing to install or update
Generating autoload files

Any ideas how to fix that?

Invalid start/stop time format

from allure-framework/allure2#609

I have an issue while trying to generate a report.

Steps to reproduce

  1. I am generating the .xml file from Codeception using allure-codeception.
  2. I am running the allure generate command to produce the report

What I see

An exception:

Exception in thread "main" java.lang.NumberFormatException: For input string: 
"1.50642981892E+12"
	at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65)

The XML file line that includes this string is:

<alr:test-suite xmlns:alr="urn:model.allure.qatools.yandex.ru" start="1.50642981892E+12" stop="1.5064299142E+12" version="1.4.0">

What I expect to see

The message that the report is created.

Environment

Allure version 2.3.5
Test framework [email protected]
Allure adaptor [email protected]
Generate report using [email protected]

change buildTestName for behat/gherkin

Hey guys, we've problem using allure in our project.(codeception 3.0.2 + behat/gherkin 4.4.0 + allure 1.4.0 )

Summary: when we run .features in codeception , allure generates xml file using name feature instead name scenario. And when in one feature there are few scenario, than allure generate just last scenario.

For example

Feature: FooterLinksTest
I want to check all links in footer

Background:
    When I log in to the site, i click button

    @footerLinksTest
    Scenario: footerLinksTest
        Then check links in Footer

   @HeaderLinksTest
    Scenario: HeadeLinksTest
        Then check links in Header

after run .feature FooterLinksTest
we get a result allure xml

<?xml version="1.0" encoding="UTF-8"?>
<alr:test-suite xmlns:alr="urn:model.allure.qatools.yandex.ru" start="1621868275968" stop="1621868340898" version="1.4.0">
  <name>acceptance (chromeheadless)</name>
  <test-cases>
    <test-case start="1621868280976" stop="1621868340846" status="passed">
      <name>HeadeLinksTest</name>
      <steps>
        <step start="1621868281331" stop="1621868281331" status="passed">
          <name>  i want to check all links in Header </name>
        </step>
      </steps>
      <labels>
        <label name="footerLinksTest" value="feature"/>
      </labels>
    </test-case>
  </test-cases>
</alr:test-suite>

and first scenario was lost

SOLUTION

if you change this
$testName = $test->getMetadata()->getFeature();
to this
$testName = $test->getScenarioNode()->getTitle();

private function buildTestName($test) {
    $testName = get_class($test->getTestClass()) . '::' . $test->getName();
    if ($test instanceof Cest) {
        if(isset($this->testInvocations[$testName])) {
            $this->testInvocations[$testName]++;
        } else {
            $this->testInvocations[$testName] = 0;
        }
        $currentExample = $test->getMetadata()->getCurrent();
        if ($currentExample && isset($currentExample['example']) ) {
            $testName .= ' with data set #' . $this->testInvocations[$testName];
        }
    } else if($test instanceof Gherkin) {
         $testName = $test->getScenarioNode()->getTitle();
    }
    return $testName;
}

after changed allure generates every scenario

What do you think about it? or did you miss something ?

Automatically set layer for tests

For now, layer (acceptance, manual, etc.) can be set for each test individually, requiring a lot of work. It seems that we can set this label automatically.

Codeception Tests that contain @env do not execute due to an Allure import error message

I'm submitting a ...

  • bug report
  • [ ] feature request
  • [ ] support request

What is the current behavior?

When you have a Codeception test that includes a @env Test Annotation, like the following, and you run it you receive an Allure related error message:

Example Test
use Magento\AcceptanceTestFramework\AcceptanceTester;
use Yandex\Allure\Adapter\Annotation\Features;
use Yandex\Allure\Adapter\Annotation\Stories;
use Yandex\Allure\Adapter\Annotation\Title;
use Yandex\Allure\Adapter\Annotation\Description;
use Yandex\Allure\Adapter\Annotation\Parameter;
use Yandex\Allure\Adapter\Annotation\Severity;
use Yandex\Allure\Adapter\Model\SeverityLevel;
use Yandex\Allure\Adapter\Annotation\TestCaseId;

/**
 * @env chrome
 * @env firefox
 * @env phantomjs
 */
class LogIntoAdminCest
{
	public function logIntoAdmin(AcceptanceTester $I)
	{
		$I->amOnPage("admin/admin");
		$I->fillField("#username", "user");
		$I->fillField("#login", "blahblah");
		$I->click(".actions .action-primary");
		$I->seeInCurrentUrl("admin/admin");
	}
}
Stacktrace
  [Semantical Error] The annotation "@env" in method 
  LogIntoAdminCest::logIntoAdmin() was never imported. Did you maybe 
  forget to add a "use" statement for this annotation?    


  Exception trace:
  () at /vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/AnnotationException.php:54
  Doctrine\Common\Annotations\AnnotationException::semanticalError() at /vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/DocParser.php:727
  Doctrine\Common\Annotations\DocParser->Annotation() at /vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/DocParser.php:663
  Doctrine\Common\Annotations\DocParser->Annotations() at /vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/DocParser.php:354
  Doctrine\Common\Annotations\DocParser->parse() at /vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/AnnotationReader.php:284
  Doctrine\Common\Annotations\AnnotationReader->getMethodAnnotations() at /vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/IndexedReader.php:71
  Doctrine\Common\Annotations\IndexedReader->getMethodAnnotations() at /vendor/allure-framework/allure-php-api/src/Yandex/Allure/Adapter/Annotation/AnnotationProvider.php:43
  Yandex\Allure\Adapter\Annotation\AnnotationProvider::getMethodAnnotations() at /vendor/allure-framework/allure-codeception/src/Yandex/Allure/Adapter/AllureAdapter.php:250
  Yandex\Allure\Adapter\AllureAdapter->testStart() at n/a:n/a
  call_user_func() at /vendor/symfony/event-dispatcher/EventDispatcher.php:212
  Symfony\Component\EventDispatcher\EventDispatcher->doDispatch() at /vendor/symfony/event-dispatcher/EventDispatcher.php:44
  Symfony\Component\EventDispatcher\EventDispatcher->dispatch() at /vendor/codeception/codeception/src/Codeception/PHPUnit/Listener.php:90
  Codeception\PHPUnit\Listener->startTest() at /vendor/phpunit/phpunit/src/Framework/TestResult.php:386
  PHPUnit_Framework_TestResult->startTest() at /vendor/codeception/codeception/src/Codeception/Test/Test.php:74
  Codeception\Test\Test->run() at /vendor/phpunit/phpunit/src/Framework/TestSuite.php:722
  PHPUnit_Framework_TestSuite->run() at /vendor/codeception/codeception/src/Codeception/PHPUnit/Runner.php:106
  Codeception\PHPUnit\Runner->doEnhancedRun() at /vendor/codeception/codeception/src/Codeception/SuiteManager.php:157
  Codeception\SuiteManager->run() at /vendor/codeception/codeception/src/Codeception/Codecept.php:184
  Codeception\Codecept->runSuite() at /vendor/codeception/codeception/src/Codeception/Codecept.php:175
  Codeception\Codecept->run() at /vendor/codeception/codeception/src/Codeception/Command/Run.php:376
  Codeception\Command\Run->runSuites() at /vendor/codeception/codeception/src/Codeception/Command/Run.php:303
  Codeception\Command\Run->execute() at /vendor/symfony/console/Command/Command.php:264
  Symfony\Component\Console\Command\Command->run() at /vendor/symfony/console/Application.php:874
  Symfony\Component\Console\Application->doRunCommand() at /vendor/symfony/console/Application.php:228
  Symfony\Component\Console\Application->doRun() at /vendor/symfony/console/Application.php:130
  Symfony\Component\Console\Application->run() at /vendor/codeception/codeception/src/Codeception/Application.php:103
  Codeception\Application->run() at /vendor/codeception/codeception/codecept:36

  run [-o|--override OVERRIDE] [-e|--ext EXT] [--report] [--html [HTML]] [--xml [XML]] [--tap [TAP]] [--json [JSON]] [--colors] [--no-colors] [--silent] [--steps] [-d|--debug] [--coverage [COVERAGE]] [--coverage-html [COVERAGE-HTML]] [--coverage-xml [COVERAGE-XML]] [--coverage-text [COVERAGE-TEXT]] [--coverage-crap4j [COVERAGE-CRAP4J]] [--no-exit] [-g|--group GROUP] [-s|--skip SKIP] [-x|--skip-group SKIP-GROUP] [--env ENV] [-f|--fail-fast] [--no-rebuild] [--] [<suite>] [<test>]

What is the expected behavior?

I should be able to list a non-allure tag in the codeception.yml file and have Allure ignore those tags.

    enabled:
        - Codeception\Extension\RunFailed
        - Yandex\Allure\Adapter\AllureAdapter
    config:
        Yandex\Allure\Adapter\AllureAdapter:
            deletePreviousResults: true
            outputDirectory: allure-results
            ignoredAnnotations:
                - zephyrId
                - env

Other Information

After the following commit, 5088ee4f7a6f76dfc4d664d4d2ac8ebd2697de01, was made our Codeception project no longer runs when the @env annotation is included in a Test.

After reverting some of the changes that were made to the _initialize function our Tests began running without the above error.

Missing tests in report

Hey guys, we've encountered some problem using allure in our project.
Summary: when you have same test names in different Cests - you see in report just 1 (last) test.

How to reproduce:

  1. Assume you have Cest files:
    FirstCest.php
    SecondCest.php
    with test names tryToTest().
  2. Run tests
  3. Allure serve

Actual behavior:
Test report contains 1 test.

Expected behavior:
Test report contains 2 tests.

We can reproduce issue at this repo:
https://github.com/barsukov2/codeception-allure-error

And for now we don't have a good solution. First thought, that we at
https://github.com/allure-framework/allure-codeception/blob/a69800eeef83007ced9502a3349ff72f5fb6b4e2/src/Yandex/Allure/Codeception/AllureCodeception.php
we can modify buildTestName()
and build $testName like $testFullName
For example,

private function buildTestName($test) {
    $testName = get_class($test->getTestClass()) . '::' . $test->getName();
    if ($test instanceof Cest) {
        if(isset($this->testInvocations[$testName])) {
            $this->testInvocations[$testName]++;
        } else {
            $this->testInvocations[$testName] = 0;
        }
        $currentExample = $test->getMetadata()->getCurrent();
        if ($currentExample && isset($currentExample['example']) ) {
            $testName .= ' with data set #' . $this->testInvocations[$testName];
        }
    } else if($test instanceof Gherkin) {
        $testName = $test->getMetadata()->getFeature();
    }
    return $testName;
}

Actually, it works.
But maybe there is a better solution... Please, any thoughts? :)

Tests statistics in the report is not complete since 1.4.1

the number of tests decreased tragically on the report generated. Normally I have around 500 tests executed, since the latest release I can only see 154 tests.

What I checked:

  • the execution time still the same.
  • the output folder for the xml files, it has all the info about all tests
  • the testsuite.xml files inside Allure results folder, it has records for all the tests

so, everything was fine except the report itself, so I guess the problem would be on the report generation process itself.

The number of tests went back to normal when I downgraded to 1.4.0

Can't generate allure report in ver. 1.2.6

Windows 7, 10
allure-codeception 1.2.6

After this example code:

public function loginSuccessfully(AcceptanceTester $I)
{
$I->fillField('[name="text"]', "Codeception");
$I->click('Найти');
$I->comment('Перешли на сайт яндекса');
$I->comment('We are going on yandex');
}

I get allure result in xml:

<step start="1517603309475" stop="1517603309475" status="passed"> <name>🰵񐰵񈰻𸠰߰Р񃰰𹱂 񟰾𴰵𺱃𰠼/name> </step> <step start="1517603309475" stop="1517603309475" status="passed"> <name>we are going on yandex </name> </step>

And when i run allure generate i get errors like:

com.fasterxml.jackson.core.JsonParseException: Invalid UTF-8 middle byte 0xf0 (at char #790, byte #37)

In previous version 1.2.5 it works correctly.

The allure report doesn't take into account Gherkin feature files

Hi all,

We've configured the latest dev version with codeception 2.2.10

extensions:
    enabled: 
        - Codeception\Extension\RunFailed
        - Yandex\Allure\Adapter\AllureAdapter
    config:
        Yandex\Allure\Adapter\AllureAdapter:
            deletePreviousResults: false
            outputDirectory: allure-results

We have the following feature file in tests/acceptance:

@login
Feature: login
  As a registered user
  I want the ability to login
  Using email and password

  Scenario Outline: Login
    Given that I am on "Home Page"
    When I go to "Login Page"
      And I enter <email> as the email address
      And I enter <password> as the password
      And I login
    Then I should be on <page>

    Examples:
      | email                                  | password            | page                     |
      | "[email protected]"          | "pass1!"     | "Account Dashboard Page" |
      | "[email protected]"     | "pass1!"     | "Login Page"             |
      | "[email protected]"          | "incorrectPassword" | "Login Page"             |

We can run the tests and they behave as expected.
When I run allure generate tests/_output/allure-results (I have on my mac allure command line tools 1.4.23 installed with brew) I get a report with the following issues:

  • there's no feature name
  • there's no story name
  • the Feature description from my feature file appear as steps in the report
  • none of the steps defined in the Scenario Outline appear in the report
  • only Actor actions appear in the report (for example $I->click()).

Please see a screenshot with the obtained report:
codeception_gherking_allure_report

I also attached the xml file (you need to change the extension from .txt to .xml).
4f8a921d-2dfe-48c3-a065-008b71f1c234-testsuite.txt

Update for Codeception 2.1

Could you provide an update to the extension class to support Codeception 2.1? They changed a few things concerning extensions and namespaces, which seem to break this version.

How to config custom ignored annotations?

Hello!
I tried to add custom ignored annotations with something like

    config:
          Yandex\Allure\Adapter\AllureAdapter:
              deletePreviousResults: true
              outputDirectory: allure-results
              ignoredAnnotations:
                  - myAnnotation1
                  - myAnnotation2

I can see that they are applied to config value, but these config values are not used in the AllureAdapter class. Is it the correct way to configure custom ignored annotations or is it a bug? Thanks!

Class annotation are overriden by Method annotations

These lines of code call the updateTestCaseEvent method twice
https://github.com/allure-framework/allure-codeception/blob/1.2.6/src/Yandex/Allure/Adapter/AllureAdapter.php#L261-L270

updateTestCaseEvent method populates the parameters of event with setParameters call
https://github.com/allure-framework/allure-php-commons/blob/master/src/Yandex/Allure/Adapter/Annotation/AnnotationManager.php#L112

setParameters replaces parameters, not appending them
https://github.com/allure-framework/allure-php-commons/blob/master/src/Yandex/Allure/Adapter/Event/TestCaseStartedEvent.php#L154

So if we have bot class and method annotations - parameters generated after parsing method annotations take precedence and drop every class annotation impact

I think we need to involve some kind of merging here

codeception 2.3.x support

allure-codeception 1.1.1 -> codeception/codeception 2.0
latest codeception/codeception version is 2.3.x

have problems installing

xml results are insta-deleted when used with Codeception 2.2.9

Currently following config

  config:
    Yandex\Allure\Adapter\AllureAdapter:
      deletePreviousResults: true
      outputDirectory: ../Metadata/Allure

simply deletes all results right after tests are run (or prevent them from spawning in the first place).

There is possibility i'll fix it myself and send a PR, but not sure if i'll have spare time as well

When updating codeception to version 5.0.7 and allure-framework/allure-codeception v2.1.0, a problem appears with running tests

When updating codeception/codeception to version 5.0.7 and allure-framework/allure-codeception to v2.1.0, we encountered an issue with running tests. The configuration of extensions is as per GitHub.

extensions:
    enabled:
        - Qameta\Allure\Codeception\AllureCodeception
    config:
        Qameta\Allure\Codeception\AllureCodeception:
            deletePreviousResults: true
            outputDirectory: allure-results
            ignoredAnnotations:
                - env
                - dataProvider
                - skip

In the previous version, there was a method called _initialize responsible for initializing the extension.

/**
     * {@inheritDoc}
     *
     * @throws ConfigurationException
     * phpcs:disable PSR2.Methods.MethodDeclaration.Underscore
     */
    public function _initialize(): void
    {
        QametaAllure::reset();
        $this->testLifecycle = null;
        $this->threadDetector = null;
        QametaAllure::getLifecycleConfigurator()
            ->setStatusDetector(new StatusDetector(new DefaultStatusDetector()))
            ->setOutputDirectory($this->getOutputDirectory());

        foreach ($this->getLinkTemplates() as $linkType => $linkTemplate) {
            QametaAllure::getLifecycleConfigurator()->addLinkTemplate($linkType, $linkTemplate);
        }

        $this->callSetupHook();
    }

In the new version, a subscription to the module event has been introduced (not an extension).

    protected static array $events = [
        Events::MODULE_INIT => 'moduleInit',
        Events::SUITE_BEFORE => 'suiteBefore',
        Events::SUITE_AFTER => 'suiteAfter',
        Events::TEST_START => 'testStart',
        Events::TEST_FAIL => 'testFail',
        Events::TEST_ERROR => 'testError',
        Events::TEST_INCOMPLETE => 'testIncomplete',
        Events::TEST_SKIPPED => 'testSkipped',
        Events::TEST_SUCCESS => 'testSuccess',
        Events::TEST_END => 'testEnd',
        Events::STEP_BEFORE => 'stepBefore',
        Events::STEP_AFTER => 'stepAfter'
    ];

    private ?ThreadDetectorInterface $threadDetector = null;

    private ?TestLifecycleInterface $testLifecycle = null;

    /**
     * {@inheritDoc}
     *
     * @throws ConfigurationException
     * phpcs:disable PSR2.Methods.MethodDeclaration.Underscore
     */
    public function moduleInit(): void
    {
        QametaAllure::reset();
        $this->testLifecycle = null;
        $this->threadDetector = null;
        QametaAllure::getLifecycleConfigurator()
            ->setStatusDetector(new StatusDetector(new DefaultStatusDetector()))
            ->setOutputDirectory($this->getOutputDirectory());
        foreach ($this->getLinkTemplates() as $linkType => $linkTemplate) {
            QametaAllure::getLifecycleConfigurator()->addLinkTemplate($linkType, $linkTemplate);
        }
        $this->callSetupHook();
    }

That’s why the extension is not being initialized in the test and fails with an error. How should the extension be configured correctly for it to work?

[Qameta\Allure\Exception\OutputDirectoryUndefinedException]                                                                                      
  Output directory is not set for Allure. Please call Qameta\Allure\Allure::setOutputDirectory() method before accessing Allure lifecycle object.

Can't get test body for Allure reports using Codeception adapter (v.1.5.2)

Describe the bug
👋
I’ve got a question related to connecting Allure adapter for Codeception (v 1.5.2). I’ve set it up for the project (followed same settings as it’s shown for demo project on Github) (see screenshot #1), but it looks that it doesn’t really fetch test result data from .XML file generated under allure-results folder (see screenshot #2). The .xml itself has all the steps and failure details, while the report misses all this data, except the one indicated within Codeception’s report.xml - Cest name and status. (see screenshot #3)

What could be wrong here? Should I somehow manipulate with outputDirectory for that?

Configs for Allure are stored in acceptance.suite.yml :

actor: AcceptanceTester
step_decorators:
  - \Codeception\Step\Retry
  - \Codeception\Step\TryTo

extensions:
  enabled:
    - Yandex\Allure\Codeception\AllureCodeception
    - Codeception\Extension\Recorder
    - Codeception\Extension\Logger
  config:
    Yandex\Allure\Codeception\AllureCodeception:
      deletePreviousResults: true
      outputDirectory: allure-results
      ignoredAnnotations:
        - env
        - dataprovider
        - skip

The command for running tests:
docker-compose exec tests codecept run acceptance BrandAmbassadorCest --env chrome --steps --xml --html The command for running Allure server locally:
allure serve tests/_output

To Reproduce
Steps to reproduce the behavior:

  1. Get a new/existing PHP project with latest Codeception on board
  2. Setup Allure CLI
  3. Setup composer.json with Codeception and allure-codeception adapter dependencies
  4. Add custom configurations into acceptance.suite.yml
  5. Have at least one failing Cest that produce screenshots and other artifacts
  6. Execute tests, check if allure-reports folder has appeared under _tests folder in Codeception project
  7. Run Allure serve command and check if you're able to see Test body under Suites section.

Expected behavior
Test body should include all test execution steps and screenshots generated by Codeception.

Screenshots
Screenshots available here on Imgur

Additional context
I've contacted Codeception community on their Slack channel regarding that issue and they have referred me to your repo.

Annotations autoload?

Hi!
We are using allure-framework/allure-codeception
And we see that in every Cest you need to use Annotations classes, like

use Yandex\Allure\Adapter\Annotation\Title;
use Yandex\Allure\Adapter\Annotation\Description;
... etc

May be we can somehow 'globally' use/autoload this classes and do not write them every time?
Appreciate any ideas, thanks

Remove direct PHPUnit dependency

Codeception is designed to isolate user from particular version of PHPUnit used under the hood, but for historical reason we still use PHPUnit to test our integration, and even more - to set up failure status. We must remove this unnecessary dependency.

Add support for selective test run with a test plan

There is a general mechanism used by Allure adapters to run tests selectively. It uses a test plan - a .json file with the following schema:

{
    "type": "object",
    "properties": {
        "tests": {
            "type": "array",
            "items": {
                "type": "object",
                "properties": {
                    "id": { "type": "string" },
                    "selector": { "type": "string" }
                }
            }
        }
    }
}

A path to a test plan is provided as a value of the ALLURE_TESTPLAN_PATH environment variable.

If a valid test plan file is provided, only matched tests should be run. A test is matched if there is at least one entry in the tests array, such that:

  1. If the id property is present in the entry AND the test has an Allure ID (added via the allure_id or as_id label), the id property must be the same as the Allure ID of the test, OR
  2. If the selector property is present in the entry, it must be the same as the test's fullName.

Motivation

Test plan support allows selective runs from TMS (e.g., TestOps). Ideally, the mechanism should be supported by all Allure adapters.

php 8 support

Hey guys,
we're planning to go on php8.
So, composer why-not php 8 tells me
jms/serializer 1.14.1 requires php (^5.5|^7.0)

That's because
allure-framework/allure-codeception require "allure-framework/allure-php-api": "~1.2.1"
and allure-framework/allure-php-api require "jms/serializer": "^0.16 || ^1.0"

Do we have any plans to make support of newer versions allure-framework/allure-php-api (that supports jms/serializer upper versions)?

Doesn't show Step names in the report

I have simple Codeception Acceptance testcase (I'll include code letter).
I ran the test and generate report via command:

C:\Users\ognezdyonova\workspace\InvoiceCentralCodeception>allure generate -v 1.4.1 C:\Users\ognezdyonova\workspace\InvoiceCentralCodeception\allure-results

But in the report itself I can't see the Step names or method names only text "Step" which makes this report useless.

I attached screenshot.

Code of testcase:

wantTo('Test ACH Payments'); $I->icACHDbUpdate($I, ACHPaymentData::$icUname); /** - Login to IC with Helper Class - Validating the Open Invoice page */ $I->icLogin($I, ACHPaymentData::$icUname, ACHPaymentData::$icPwd); /** - Test Scenario 1: Add bank account via plaid throw payment process. */ $I->wantTo('Test Scenario 1: Add bank account via plaid throw payment process.'); $I->checkOption(['xpath' => '//input[@value="'.ACHPaymentData::$selectInvoice1.'"]']); $I->click(['xpath' => OpenTabPage::$ic_paySelectedBtn]); $I->waitForText('Number of Invoices:'); $I->selectOption('form select[name=payment_paymentAccount_'.ACHPaymentData::$selectInvoice1.']', ACHPaymentData::$achAddNewAccount); $I->waitForText('Option One: Select your bank', 2); //Select Bank from the list $I->icSelectBank($I, PlaidACHPage::$ic_bankOfAmerica); $I->waitForText('Log in', 2); //Login to the bank account $I->icLoginBank($I, PlaidACHPage::$ic_plaidUser, PlaidACHPage::$ic_plaidPwd); $I->waitForText('Verify Account'); //Verify MFA question $I->icMfaQuestion($I, PlaidACHPage::$ic_plaidResponse); $I->waitForText('Choose Accounts', 2); //Select Primary Checking Account $I->icSelectPrimaryChecking($I, PlaidACHPage::$ic_regularChecking1, PlaidACHPage::$ic_regularChecking1); $I->fillField(['xpath' => '//input[@id="payment_paymentAmount_'.ACHPaymentData::$selectInvoice1.'"]'],ACHPaymentData::$selectAchAmount1); $I->icAddMemoQuick($I, CCPaymentData::$row, ACHPaymentData::$memo); $I->click('Next'); // Verify the correct payment amount is showing as Total Amount in Authorization and Confirmation page $I->icVerifyTotalAmount($I, ACHPaymentData::$selectAchAmount1); $I->wait(2); $I->click('close'); // Verify that we are navigating back to the Home page after successful payment and then Cancel the payment $I->icCancelPayment($I); // Delete CC payment account $I->icDeleteACHPayAccount($I, ACHPaymentData::$icUname); ![2015_04_22_16_10_46_allure_dashboard](https://cloud.githubusercontent.com/assets/7072308/7284254/608b0e04-e90a-11e4-8018-cf5886b6bf47.jpg)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.