我升级到<allure2.version>2.0-BETA14了Maven项目的最新版本.test-results文件夹是在项目目录而不是target目录下生成的.
我已经浏览了倾城文档网站,他们建议<allure.results.directory>在系统路径中添加覆盖,但它似乎不起作用.
我正在以编程方式构建我的TestNG套件.这与allure1完全一致.
以下是我的pom.xml:
<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>com.mycompany.test.projectA</groupId>
<artifactId>scarpbook</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>scarpbook</name>
<url>http://maven.apache.org</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<java.version>1.8</java.version>
<testng.version>6.10</testng.version>
<surefire.plugin.version>2.19.1</surefire.plugin.version>
<allure.version>2.0-BETA14</allure.version>
<aspectj.version>1.8.10</aspectj.version>
<allure.results.directory>target/allure-results</allure.results.directory>
<allure.report.directory>target/allure-report</allure.report.directory>
<tms>
https://github.com/allure-framework/allure-docs/issues/{}
</tms>
</properties>
<dependencies>
<dependency>
<groupId>com.mycompany.testlib</groupId>
<artifactId>lib</artifactId>
<version>1.0</version>
</dependency>
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>${testng.version}</version>
</dependency>
<dependency>
<groupId>io.qameta.allure</groupId>
<artifactId>allure-testng</artifactId>
<version>${allure.version}</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
<version>1.7.21</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.1.1</version>
<executions>
<execution>
<goals>
<goal>exec</goal>
</goals>
</execution>
</executions>
<configuration>
<executable>java</executable>
<mainClass>com.mycompany.testlib.testrunner</mainClass> …Run Code Online (Sandbox Code Playgroud) 我正在使用Allure2和TestNG.我想编写自己的监听器,在控制台输出中打印@Steps.
我在魅力中看到了界面"StepLifecycleListener",但我无法在TestNg中实现这个侦听器.有什么指针吗?
@Override
public void beforeStepStart(final StepResult result) {
System.out.format("Starting step: %s", result.getName());
}
@Override
public void afterStepStop(final StepResult result) {
System.out.format("Completed step: %s", result.getName());
}
Run Code Online (Sandbox Code Playgroud)