Unable to save allure report screeshots using TestNG

大城市里の小女人 提交于 2019-12-05 19:06:54

In order to make such Allure features like: attachments, steps and parameters work as expected you need to correctly specify -javaagent argument. Under Windows the following notation should work:

        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-surefire-plugin</artifactId>
            <version>2.16</version>
            <configuration>
                <argLine>
                    -javaagent:"${settings.localRepository}\org\aspectj\aspectjweaver\${aspectj.version}\aspectjweaver-${aspectj.version}.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>${aspectj.version}</version>
                </dependency>
            </dependencies>
        </plugin>

Note quotes around path. Without correct -javaagent specification your @Attachment, @Step and @Parameter annotations will be ignored by Allure.

Dmitry Baev

Seems like Allure can't create default allure-results folder. Try specify allure.results.directory to some path:

<properties>
    <allure.results.directory>${project.build.directory}/allure-results</allure.results.directory>
</properties>
...
<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-surefire-plugin</artifactId>
    <version>2.14</version>
    <configuration>
        <argLine>
            -javaagent:"${settings.localRepository}\org\aspectj\aspectjweaver\${aspectj.version}\aspectjweaver-${aspectj.version}.jar"
        </argLine>
        <!--only for 1.3.* TestNG adapters. Since 1.4.0.RC4 listener adds via ServiceLoader-->
        <properties>
            <property>
                <name>listener</name>
                <value>ru.yandex.qatools.junit.spi.RunListenerWeaver</value>
            </property>
        </properties>
        <systemProperties>
            <property>
                <name>allure.results.directory</name>
                <value>${allure.results.directory}</value>
            </property>
        </systemProperties>
    </configuration>
    <dependencies>
        <dependency>
            <groupId>org.aspectj</groupId>
            <artifactId>aspectjweaver</artifactId>
            <version>${aspectj.version}</version>
        </dependency>
    </dependencies>
</plugin>

Full pom.xml is located at https://gist.github.com/baev/a47505208fc0214b833d

Note: you only need to add allure-testng-dependency

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!