Skip to content

Allure Reports Missing Test Name when test uses magentoDataFixture or other custom annotation #39208

Open
@dmanners

Description

@dmanners

Preconditions and environment

  • 2.4.6 and 2.4.7
  • Allure 2.30.0

Steps to reproduce

  1. Run the integration tests when a test contains a magentoDataFixture or other custom magento annotation.
  2. View the resulting json file of the test in dev/tests/integration/var/allure-results

Expected result

The name should be filled in the json file

Actual result

The name is empty in the json file

Additional information

This seems to have been an issue brought in with version 2.4.6 and the move from a listener to an extension for the allure config.

Old version: https://github.com/magento/magento2/blob/2.4.5/dev/tests/integration/phpunit.xml.dist#L95

To fix this we have added a new custom extension.

<extension class="Fix\IntegrationTests\Extension\IgnoreMagentoAnnotations">
            <arguments>
                <array>
                    <element key="codingStandardsIgnoreStart">
                        <string>codingStandardsIgnoreStart</string>
                    </element>
                    <element key="codingStandardsIgnoreEnd">
                        <string>codingStandardsIgnoreEnd</string>
                    </element>
                    <element key="expectedExceptionMessageRegExp">
                        <string>expectedExceptionMessageRegExp</string>
                    </element>
                    <element key="magentoAdminConfigFixture">
                        <string>magentoAdminConfigFixture</string>
                    </element>
                    <element key="magentoAppArea">
                        <string>magentoAppArea</string>
                    </element>
                    <element key="magentoAppIsolation">
                        <string>magentoAppIsolation</string>
                    </element>
                    <element key="magentoCache">
                        <string>magentoCache</string>
                    </element>
                    <element key="magentoComponentsDir">
                        <string>magentoComponentsDir</string>
                    </element>
                    <element key="magentoConfigFixture">
                        <string>magentoConfigFixture</string>
                    </element>
                    <element key="magentoDataFixture">
                        <string>magentoDataFixture</string>
                    </element>
                    <element key="magentoDataFixtureBeforeTransaction">
                        <string>magentoDataFixtureBeforeTransaction</string>
                    </element>
                    <element key="magentoDbIsolation">
                        <string>magentoDbIsolation</string>
                    </element>
                    <element key="magentoIndexerDimensionMode">
                        <string>magentoIndexerDimensionMode</string>
                    </element>
                </array>
            </arguments>
        </extension>

And the class looks as follows:

<?php
declare(strict_types=1);

namespace Fix\IntegrationTests\Extension;

use PHPUnit\Runner\BeforeFirstTestHook;
use Doctrine\Common\Annotations\AnnotationReader;

class IgnoreMagentoAnnotations implements BeforeFirstTestHook
{
    /**
     * @param array $configOptions
     */
    public function __construct(
        private readonly array $configOptions = []
    ) {
    }

    /**
     * Setup all the given names to be ignored by the annotation reader
     *
     * @return void
     */
    public function executeBeforeFirstTest(): void
    {
        foreach ($this->configOptions as $annotationNameToIgnore) {
            AnnotationReader::addGlobalIgnoredName($annotationNameToIgnore);
        }
    }
}

Release note

No response

Triage and priority

  • Severity: S0 - Affects critical data or functionality and leaves users without workaround.
  • Severity: S1 - Affects critical data or functionality and forces users to employ a workaround.
  • Severity: S2 - Affects non-critical data or functionality and forces users to employ a workaround.
  • Severity: S3 - Affects non-critical data or functionality and does not force users to employ a workaround.
  • Severity: S4 - Affects aesthetics, professional look and feel, “quality” or “usability”.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Area: Test frameworkComponent: IntegrationIssue: ConfirmedGate 3 Passed. Manual verification of the issue completed. Issue is confirmedPriority: P2A defect with this priority could have functionality issues which are not to expectations.Progress: ready for devReported on 2.4.7Indicates original Magento version for the Issue report.Reproduced on 2.4.xThe issue has been reproduced on latest 2.4-develop branchTriage: Dev.ExperienceIssue related to Developer Experience and needs help with Triage to Confirm or Reject it

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions