在对吸引力报告进行测试时,我们会看到
没有有关测试执行的信息
未列出任何步骤。 (我们看到了测试,但没有看到测试步骤)
使用Maven通过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>
使用的命令:
mvn clean 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()
{
}
}
有步骤:
@Step("xxxxx")
public XXX xxxxxx()
{
xxxxx.click();
return this;
}
对此颇为棘手,不幸的是,我继承了这组测试,却迷失了为什么它不起作用。检查了设置了一个常见问题的方面,看起来不错。
答案 0 :(得分:0)
您需要将诱惑结果目录设置为让诱惑知道从何处获取这些文件。
在<configuration>
扇区中粘贴以下内容:
<systemProperties>
<property>
<name>allure.results.directory</name>
<value>${project.build.directory}/allure-results</value>
</property>
</systemProperties>
请注意,如果要使用TestNG,则需要导入TestNG的吸引力。
<dependency>
<groupId>io.qameta.allure</groupId>
<artifactId>allure-testng</artifactId>
<version>2.12.1</version>
</dependency>
您真的需要使用yandex魅力插件吗?如果没有,我建议您对Maven插件使用简单的吸引力:
<plugin>
<groupId>io.qameta.allure</groupId>
<artifactId>allure-maven</artifactId>
<version>2.10.0</version>
</plugin>