简体   繁体   中英

Allure @Step annotation not appearing on the Allure Report (Maven/TestNG)

When drilling into a test on the allure report, we see

No information about test exection is available

No steps are listed. (We do see the test, but not the test steps)

Tests were run using Maven via TestNG

POM:

<properties>
        <aspectj.version>1.8.13</aspectj.version>
        <threads>1</threads>
        <groups/>
        <!-- Prevent encoding issues -->
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
    </properties>


    <build>
        <plugins>
            <plugin>
                <groupId>io.qameta.allure</groupId>
                <artifactId>allure-maven</artifactId>
                <version>2.10.0</version>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.surefire</groupId>
                <artifactId>maven-surefire-common</artifactId>
                <version>3.0.0-M3</version>
                <configuration>
                    <systemProperties>
                        <property>
                            <name>allure.results.directory</name>
                            <value>${project.build.directory}/allure-results</value>
                        </property>
                    </systemProperties>
                    <argLine>
                        -javaagent:"${settings.localRepository}/org/aspectj/aspectjweaver/1.8.13/aspectjweaver-1.8.13.jar"
                    </argLine>
                    <properties>
                        <property>
                            <name>listener</name>
                            <value>ru.yandex.qatools.allure.testng.AllureTestListener</value>
                        </property>
                    </properties>
                </configuration>
                <dependencies>
                    <dependency>
                        <groupId>org.aspectj</groupId>
                        <artifactId>aspectjweaver</artifactId>
                        <version>1.8.13</version>
                    </dependency>
                    <dependency>
                        <groupId>io.qameta.allure</groupId>
                        <artifactId>allure-testng</artifactId>
                        <version>2.12.1</version>
                    </dependency>
                </dependencies>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.8.0</version>
                <configuration>
                    <source>8</source>
                    <target>8</target>
                </configuration>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <configuration>
                    <source>8</source>
                    <target>8</target>
                </configuration>
            </plugin>
        </plugins>
    </build>

Command used: mvn clean test

Sample Test:

    @Features("XXXX")
@Stories("XXXXX")
@Test(groups = {"xxxxxxxx"})
public class xxxxxxxxxxxx
{

    @BeforeMethod
    public void Setup() throws InterruptedException {

    }

    public void xxxxxxx() throws InterruptedException
    {
    }


    @AfterMethod
    public void shutDown()
    {

    }
}

With Steps:

@Step("xxxxx")
    public XXX xxxxxx()
    {
        xxxxx.click();
        return this;
    }

Quite stuck with this, unfortunately I inherited this suite of tests and lost as to why it is not working. Have checked that aspect was set which is a common problem, looks fine.

You need to set allure results directory to let allure know where to get these files. Paste something like this inside <configuration> sector:

<systemProperties>
   <property>
      <name>allure.results.directory</name>
      <value>${project.build.directory}/allure-results</value>
    </property>
</systemProperties>

PLus, if you want to work with TestNG, you need to import allure for TestNG.

<dependency>
 <groupId>io.qameta.allure</groupId>
 <artifactId>allure-testng</artifactId>
 <version>2.12.1</version>
</dependency>

Do you really need to use yandex allure plugin? if not, i would recommend you to use simple allure for maven plugin:

<plugin>
        <groupId>io.qameta.allure</groupId>
        <artifactId>allure-maven</artifactId>
        <version>2.10.0</version>
</plugin>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM