我正在尝试为我的Selenium Webdriver TestNG Maven项目使用诱惑报告。我使用了Allure文档和示例中指定的AllureListener类。然而,我无法将截图正确地附加到报告中。以下是我的观察:
我的要求:我希望将截图文件存储在allure-results中的目标位置,而不是临时位置。所以我可以随时控制报告。我的测试结果也没有在这一点上产生。我在这一点上做错了什么吗?
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>AllureProj</groupId>
<artifactId>AllureProj</artifactId>
<version>0.0.1-SNAPSHOT</version>
<properties>
<compiler.version>1.7</compiler.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<allure.version>1.4.0.RC3</allure.version>
<aspectj.version>1.8.1</aspectj.version>
<settings.localRepository>C:/Users/steve/.m2/repository </settings.localRepository>
<aetherVersion>0.9.0.M2</aetherVersion>
<mavenVersion>3.1.0</mavenVersion>
<wagonVersion>2.6</wagonVersion>
</properties>
<build>
<sourceDirectory>src</sourceDirectory>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>2.2.1</version>
<executions>
<execution>
<id>attach-sources</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.16</version>
<configuration>
<argLine>
<!-- -javaagent:F:\\Selenium\\Workspace\\AllureProj\lib\\aspectjweaver-1.7.4.jar -->
-javaagent:F:/Selenium/Workspace/AllureProj/lib/aspectjweaver-1.8.1.jar
<!-- -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>
<plugin>
<groupId>org.codehaus.sonar</groupId>
<artifactId>sonar-maven-plugin</artifactId>
<version>4.0</version>
</plugin>
</plugins>
</build>
<reporting>
<plugins>
<plugin>
<groupId>ru.yandex.qatools.allure</groupId>
<artifactId>allure-maven-plugin</artifactId>
<version>${allure.version}</version>
<configuration>
<outputDirectory>F:\\Selenium\\Workspace\\AllureOSP\\target\\allure-results</outputDirectory>
<allureResultsDirectory>F:\\Selenium\\Workspace\\AllureOSP\\target\\allure-results</allureResultsDirectory>
</configuration>
</plugin>
</plugins>
</reporting>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-core</artifactId>
<version>1.3</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>6.8.8</version>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>2.42.2</version>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-firefox-driver</artifactId>
<version>2.42.0</version>
</dependency>
<dependency>
<groupId>ru.yandex.qatools.allure</groupId>
<artifactId>allure-testng-adaptor</artifactId>
<version>${allure.version}</version>
</dependency>
<dependency>
<groupId>com.github.detro</groupId>
<artifactId>phantomjsdriver</artifactId>
<version>1.2.0</version>
</dependency>
<dependency>
<groupId>com.github.detro.ghostdriver</groupId>
<artifactId>phantomjsdriver</artifactId>
<version>1.0.4</version>
</dependency>
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-all</artifactId>
<version>1.3</version>
</dependency>
<dependency>
<groupId>net.anthavio</groupId>
<artifactId>phanbedder-1.9.7</artifactId>
<version>1.0.0</version>
</dependency>
<dependency>
<groupId>ru.yandex.qatools.allure</groupId>
<artifactId>allure-java-annotations</artifactId>
<version>${allure.version}</version>
</dependency>
<dependency>
<groupId>ru.yandex.qatools.allure</groupId>
<artifactId>allure-java-aspects</artifactId>
<version>${allure.version}</version>
</dependency>
<dependency>
<groupId>ru.yandex.qatools.allure</groupId>
<artifactId>allure-report-data</artifactId>
<version>${allure.version}</version>
</dependency>
<dependency>
<groupId>ru.yandex.qatools.allure</groupId>
<artifactId>allure-java-commons</artifactId>
<version>${allure.version}</version>
</dependency>
<dependency>
<groupId>ru.yandex.qatools.allure</groupId>
<artifactId>allure-commons</artifactId>
<version>1.4.0.RC4</version>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<version>1.8.5</version>
</dependency>
</dependencies>
</project>
Allure似乎无法创建默认的< code>allure-results文件夹。尝试将< code > allure . results . directory 指定到某个路径:
<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>
pom.xml位于https://gist.github.com/baev/a47505208fc0214b833d
注意:你只需要添加allure-testng-dependency
为了使诸如附件,步骤和参数之类的诱惑功能按预期工作,您需要正确指定-javaagent参数。在“窗口”下,以下表示法应该有效:
<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>
注意路径周围的引号。如果没有正确的-javaagent规范,您的@Attachment、@Step和@Parameter注释将被Allure忽略。
我面临着一个奇怪的问题,我的诱惑测试报告没有显示测试身体部分。这是我的maven命令 这是我的pom文件:我也附上了报告截图,问题是它不包括测试部分。 http://maven.apache.org/xsd/maven-4.0.0.xsd" 这是cucumber赛跑者文件
上面的代码用于生成allure报告并运行测试,它运行并生成reports-allure-results中的一个文件夹,其中包含JSON文件。见下方截图
7.1.0 MVN测试命令应该正常执行测试,知道同样的POM在我更新testNG和其他一些依赖之前工作正常,我也在testNG和maven中使用诱惑力,现在如果我禁用诱惑力-TestNG测试将被执行,但诱惑力不会生成任何报告 我收到此错误。有关单个测试结果,请参阅C:\Users\warrior\Desktop\MobileAutomationTest\target\surefire报告。请参阅转
我无法使用allure-maven插件生成AllureTestHTML报告。我使用的是相同版本的testNG-adapter和allure maven插件(1.4.0.rc8)。但是我能够使用allure CLI生成allure html报告。排除依赖项的pom.xml是
我使用“selenide”、“testng”、“maven”、“eclipse”创建了一些自动化脚本。我试着添加诱惑力测试结果。我遵循了allure-testng-maven说明并更新了pom.xml。 要从eclipse运行测试,我要右键单击pom.xml+“run as”+“Maven test”。这是在“./target/allure-results”文件夹中执行所有testng测试和生成的
我遵循以下步骤在詹金斯得到诱惑报告,但得到错误,我能够得到本地报告 1.增加了诱惑力命令行安装(图1) 2.增加了建造后的动作诱惑力-结果(图2) [Project-Allure]$C:\Windows\System32\Config\SystemProfile\AppData\Local\Jenkins.Jenkins\Tools\ru.yandex.qatools.allure.Jenkins